在wordpress设置了静态链接之后发现中文tag搜索无结果了,网上查了一下,发现修改url重定向的一个条件就可以,找到wp-includes/rewrite.php,记得备份。

其实你只需要把rewrite.php中的一个判断条件由”是”改为”非”就好了。下面给出代码:
—————————————————————
function get_tag_permastruct() {
if (isset($this->tag_structure)) {
return $this->tag_structure;
}
if (empty($this->permalink_structure)) { //—–this line need change——
$this->tag_structure = ”;
return false;
}
if (empty($this->tag_base))
$this->tag_structure = $this->front . ‘tag/’;
else
$this->tag_structure = $this->tag_base . ‘/’;
$this->tag_structure .= ‘%tag%’;
return $this->tag_structure;
—————————————————————
将上面标记的行替换为:
—————————————————————
if (! empty($this->permalink_structure)) { //修改if()的判断条件

ok,解决

注意:这个判断在rewrite.php里很多地方有,参照上下文,不要改错地方了!