Editing and Organizing WordPress Category Slugs

Editing and Organizing WordPress Category Slugs

In WordPress 2.7, when editing the categories or converting a category to a sub-category, the slugs will automatically replaced in a way you won’t really favor. For example, when you have a category ‘Wordpress’ with the initial slug is ‘wordpress‘ and you want to move it into a parent category ‘Blogging’, the category slug for the ‘Wordpress’ category will automatically replaced as ‘blogging-wordpress‘ instead of ‘wordpress‘. The structure will become:

yoursite.com/category/blogging/blogging-wordpress/

instead of

yoursite.com/category/blogging/wordpress/

The reason for this is because the initial slug was already in the Wordpress database and converting any category to a sub-category will be as same as creating a new category. The database will not overwrite the existing slug but will create a new one. Similar problem will occur if you try to rename a category to a name you had deleted previously. Browsing in the Wordpress Support Forum, I still can’t find any solution for this therefore I’ve decided to try on my own. Thank God I manage to find a solution but still required quite a messy job if you are not familiar with the database system of your hosting server.

Here’s what I did to fix all the category slugs:

  1. Login to your hosting server account.
  2. Open the MyPhpAdmin (or phpMyAdmin or anything with similar function).
  3. When the list of tables had been listed, look out for the wp_terms table. (note that I’m using the standard wp_ table prefix).
  4. Delete the terms and slugs that are not in use. Make sure you check the ID for every Posts Categories and Link Categories because everything are in the same table. To ease the job, I just clear or delete the table database. Just be careful not to delete all other table database. Just clear the wp_terms table database. Note that If you delete everything in the table, you have to know which ID represent your Posts Categories and which are for Link Categories because you’ll have to rebuild them again.
  5. Also edit the wp_terms_taxonomy which contains the hierarchical data of your categories. If you don’t edit this table, some new categories might be automatically become sub-categories based on previous data. My version allow me to delete all post categories and tags data in this table because they will be generated again when creating new category in the Wordpress admin page. Just don’t delete the link_category term or clear everything in this table because this will bring hell to you. I did this mistake earlier and I won’t help if you did the same mistake.
  6. After clearing the database, all the categories in you blog will be removed. Just go to the Categories section and create a new category. Just start all over again. This time make sure you plan every categories nicely to avoid any mistake. If you did make a mistake. Just repeat the steps mentioned above.

The method worked fine for me and I know there are many people are having the same problem. Please give me your feedback for this.

  • Share/Bookmark
Blog Traffic Exchange Related Posts
  • Getting Paid to Promote on Any Website I just found a simple way to make earning from the blog traffic which is by referring people to Paid-to-Promote.net....
  • Blogging and Advertising I still found somewhere "What.. you make money from blogging?" or "Is it true that I can make money from...
  • Bidvertiser [/caption] Bidvertiser is an internet advertising company offering site-targeted pay-per-click (PPC) text ads and image ads. The company was launched...
Blog Traffic Exchange Related Websites
  • Wordpress Backup Wordpress Backup is an essential plugin for all Wordpress blog administrators by the Blog Traffic Exchange. It performs regular backups...
  • How I Got First Page Google... Image via Wikipedia ...for the keyword phrase Online Marketing Minneapolis. And let me tell you. Online Marketing is a very...
  • Start 2010 Right! Free Money and Prizes Money Crashers 2010 Give Away MoneyCrashers, a personal finance blog, is having one crazy give away: Enter the Money Crashers 2010...

5 Comments»

  1. nice blog n nice info..
    ur layout so professional.. so jealous lah.. he

    comment-bottom
  2. ryanve Says:

    Thanks for this article. I had wanted to rename a category slug and when I looked in the terms table I saw why WP wasn’t letting me use the slug that I wanted. It was because I had already created a tag that was using the slug that slug. Once I renamed the tag slug, I was then able to rename the category slug (without making any changes in phpMyAdmin). Problem solved.

    comment-bottom
  3. Your article are very impressive. Thank you so much

    comment-bottom
  4. mancai Says:

    huhuhu nice info… thanks

    comment-bottom
  5. farhan Says:

    maju .hhe

    comment-bottom

RSS feed for comments on this post.TrackBack URL

Leave a comment

Kaspersky Lab eStore
ss_blog_claim=82d6a1cd43b9ee976ddc41a2e546c430