Categorizing migrated posts

February 10, 2006 · Posted in Mike's Blog 

Now that I have successfully migrated my posts from blogger and joomla, my next big problem was recategorizing them. Instead of going through each post and deciding what category to put it in, I thought of quick and dirty way to do it. It’s not efficient and I’m pretty sure it will not correctly categorize all of the articles but it does the job quick. What I did was execute a series of mysql queries in the following form:

INSERT INTO wp_post2cat SELECT ”,ID,{category_id_here} FROM wp_posts WHERE post_content LIKE ‘%keyword_here%’ OR post_title LIKE ‘%keyword_here%’;

  • Replace {category_id_here} with the proper category_id
  • Replace keyword_here with the correct keyword

Actual example is (category_id #3 is for Programming):

INSERT INTO wp_post2cat SELECT ”,ID,3 FROM wp_posts WHERE post_content LIKE ‘%mysql%’ OR post_title LIKE ‘%mysql%’;

So, I simply ran a series of those statements above for each category I have and for each keyword I could think of that would match my categories.

Did I achieve my goal? Pretty well. But of course, you might still see some misplaced articles in this website so if you find an article which you think should be placed in some other category, kindly post a comment and I will gladly move it.



Comments

Leave a Reply




Good luck to The Busby SEO Challenge