Convert WordPress Categories to Tags

Posted on June 28, 2009
Filed Under General | 2 Comments

Categories to Tags to Categories

Have you ever been in a position where you come to expect certain things to be done certain ways only to discover that your expectations were the real limitation in getting something done? Confusing? It can be. This happens many times where I approach a project following a pretty standard protocol when working with database related projects. In nearly 95% of those situations, needing to make a bulk database edit in any web based project I usually start with phpMyAdmin and after a few SQL strings or possibly a bulk find and replace I can achieve what I’m after. I call this kind of work “grunt work” because its laborious and repetitive and I usually assign it to my brother who specializes in data conversions and migrations. Recently I found myself facing this task when asked to first import blogger posts into WordPress 2.8 and then perform a bulk update by replacing all of his <div class="articletitle"> instances with <h1>. Why exactly the titles of the posts were wrapped in the DIV tags I’m not sure but the challenge was how to do this with the simultaneous replacement of the proper H1 closing tags as not to alter any other possible DIV instances. PHP comes into play at that point with the string replace which worked fine. Having exported the SQL to a CSV file and saving it to the server, the process took barley 5 minutes. The WordPress Tags were next on the clients list and at first I figured that Id need to script something a bit more involved to achieve this. This is where my initial misplaced expectation had been placed because I knew that it would take some time and I really didn’t want to start my day with the task.

The real challenge in my mind was how to convert all those dozens and dozens of WordPress Categories that were imported from Blogger into their proper or should I say desired “tag” for a better structure of the blogs overall functionality. Not really wanting to script anything, knowing that it would take a bit of time, luckily I remembered seeing but never using a clever little feature in an older install of WordPress that makes this process pretty straight forward and simple. So simple in fact that its barely worthy of a blog post, but I’ll call it a WordPress Tip because I’m sure someone out there must be curious how to do this. The process goes like this;

  1. Always make a backup of your database. Always!
  2. Next, navigate to your WordPress admin panel.
  3. Then, navigate to Posts >> Categories and at the very bottom on the right you will see “Categories can be selectively converted to tags using the category to tag converter..
  4. Simply select the categories you wish to convert and run the process.

Painless, fast and effective, once the conversion is verified you can now take advantage of this excellent feature by using TAGS in all of your posts.

Comments

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

2 Comments so far
  1. Rick July 10, 2009 10:14 am

    Jared you saved my ass! I found this post today in google thankfully. I thought i was going to have to do the same thing you mentioned except im not a coder so i would have to manually edit the db. Happy you posted this, seriously.

    How can i send you a paypal donation?
    Rick

  2. Jared Ritchey July 10, 2009 11:45 am

    Hey Rick, glad it helped, no need for PayPal donation on my blog posts but I do thank you for the offer.

    You could donate to any number of the plugins or addons I publish http://wordpress.org/extend/plugins/profile/php4ever or any of those published at UltimateIDX. I think we are up to 33 FREE plug-ins and add-ons now.

    Anyway glad you stopped by.


TEMP CODE: GDHXCDX17249629