WordPress problem: Url encoding on Tag’s slug.

When you define or assinge tags in wordpress, here is what WordPress does:

1. Every tag must have a name.

2. Every tag must have a slug, the url of the tag.

3. By default, WordPress will automatically generate the tag slug based on the name of the tag you entered.

4. However, if either the value of the tag name or the tag slug is new, then Wordpress will consider it is a new tag in the system.

So, a problem will arise, when your blog has non-western language characters or terms been used as tags.

For example, I use Chinese in my tags. In order to keep my url looks nice, every time I add a Chinese tag (or the tag contain non-western & Chinese characters), I need custom to define the tag slug after the new tag was entered in the WordPress database; because, the default slug was generated by WordPress use percentage url encoding. The problem happens when you want to use the same tag again. Because, when you are writing or editting a post in WordPress, either the built-in tag entry interface or the interface provided by some other plugins (e.g. the Simple Tags plugin), you can only choose from the exisingt tags’ name. The default tag’s entry interface in WordPress 2.5.x is worse on this aspect because it uses Ajax drop-down to suggest a list of existing tag names as you are typing into the tag entry box; but it seems can’t recognized the existing non-western tag names or those tag names have non-western character in it. Anyway, the key point is that, no matter whether you use a plugin or not, if you are assign the existing tag to your post use the tag name, and if the tag name is a non-western language tag, even it is an already existing one, WordPress will not respect the nice slug you have define before, and re-generate a pencentage url encoding slug for it. After this been done, since the newly generated slug neve exists before, WordPress further to recognized it as a new slug, thus a new tag — but, hey, what you are doing is that you are assign an existing tag to you post!

This problem has cost me much time to correct the tags in the WordPress system. I think bloggers use non-western language should have the same headache as mine. On WordPress 2.3.x, there is a nice plugin called Advanced Tag Entry which developed by the same author of the Language Switcher plugin will allow you choose tags from their slugs, and it has very nice checking to show your which slug is associate with which tag name already in the WordPress database. Saddly, Advanced Tag Entry is not available on WordPress 2.5+. It says that the Advanced Tag Entry functionality has been implimented by the core of the WordPress. But where?

I am wondering, if WordPress will improve the tags mechanism or there is a solution for this problem? If anyone know the answer, please send me a message.



感谢您阅读本文章。您现在可以 Read Comments (2)

日志信息

本日志发布于   5月 11, 2008   2:37 下午   发布在   技术   标记为:,,

你可以跟进任何对此文章的回复通过 Comments Feed. 你可以 留一个评论 ,或 一个 Trackback .



前一日志 Curl better than simplexml_load_file when web screen scrapping »
下一日志 国谷哥发布: 四川震区急需 260 万顶帐篷 »

阅读更多

相关阅读:

2 回复 到 “ WordPress problem: Url encoding on Tag’s slug.



留一个评论

注意:任何可以被发表的评论仅仅由于本站所有者同意这样做,任何评论都可能由本站所有者处于任何理由而删除。