Home > Wordpress > wordpress 中文 tag 问题补充

wordpress 中文 tag 问题补充

September 15th, 2008 humker Leave a comment Go to comments

前一段时间写过一篇帖子 wordpress 中文 url 的问题 确实可以从根本上解决 windows 下 url 重写中文 url 的问题,利用的是让url路径使用gbk编码。自己心里想一想,总感觉到有些问题,utf8的编码为什强加上gbk呢?这个方法的坏影响我还不知道,最近gg来的流量很奇怪。

后来自己想出一个折中的方法就是,只修改tag的rewrite路径,只有tag路径静态化时出现中文编码问题,干脆让他使用动态,其他的非中文路径不用管。当然这样说是在你的栏目和文章简短路径没有使用中文的情况下。下面给出修改方法。

wordpress的路径重写规则都在一个文件中,即wp-include/rewrite.php里面。找到tag的url路径函数,让他保持动态。代码在460行左右

if (empty($this->permalink_structure)) {
   $this->tag_structure = ”;
   return false;
  }

修改为

if (!empty($this->permalink_structure)) {
   $this->tag_structure = ”;
   return false;
  }

其中的原理是做相反的判断。

还要说一下,tag的功能是引导访问者的功能,对于搜索引擎来说,tag路径静态化本人认为没有多大作用,反而会加深“复制内容”的嫌疑。

Categories: Wordpress Tags: , ,
  1. October 25th, 2008 at 03:17 | #1

    还是这个简便、现实!之前的修改方法在现在的 WordPress 2.6.3 (貌似)不适用了,浏览前后台均无障碍,但是不能进行后台编辑,会提示 classes.php 额外发送了 header 数据。也有肯呢个是我偷懒没有修改 taxonomy.php 的问题……

    总之这是一个很可行的方案!

  1. No trackbacks yet.
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).