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.



Thank you for reading this post. You can now Read Comments (2)

Post Info

This entry was posted on   11 May 2008   2:37 PM   and is filed under   Technology   tagged with:,,

You can follow any responses to this entry through the Comments Feed. You can Leave A Comment , or A Trackback .



Previous Post: Curl better than simplexml_load_file when web screen scrapping »
Next Post: Emergency Aid for Chinese Earthquake: Need 2,6 million Tents right now! »

Read More

Related Reading:

2 Responses to “ WordPress problem: Url encoding on Tag’s slug.



Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.