WordPress problem: Url encoding on Tag’s slug.

When you define or assign 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 used percentage url encoding. The problem happens when you want to use the same tag again. Because, when you are writing or editing 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 existing 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 existed one, WordPress will not respect the nice slug you have define before, and re-generate a percentage url encoding slug for it. After this been done, since the newly generated slug never 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 implemented 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.

8 Comments - Leave a comment
  1. David Adam says:

    Thanks for read the article. I still wonder how non-western bloggers specify their tags of their post in WordPress.

  2. Anika says:

    Very interesting read, I think their would be a lot of mixed opinions on this. Love the theme that you are using, what is it?

  3. David Adam says:

    The theme? As the footer text says, “TypoXP Reloaded”. :)

  4. I strongly recommend that you turn the No Follow off in your comment section. I’ll watch Google Webmaster Tools, and if the links don’t show up after a couple of weeks — I won’t go back to that blog again. Another suggestion: you should have a Top Commentator widget installed. Do Follow and Top Commentator will ensure that you have a successful blog with lots of readers!

  5. ann ledesma says:

    Uq8qKF great tips. I enjoyed reading this,

  6. Shaun says:

    I was searching Google for a solution to convert a Chinese title to a pinyin slug and found this entry. Kind of a weird coincidence considering I already know you through facebook. I think this problem will take too much time to solve so I will just scrap using pinyin slugs and use a unique identifier instead.

  7. Tatesyday says:

    Cool issue, did not thought it was going to be so interesting when I klicked at the link!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*