Migrate Tags from UTW Tags to Wordpress 2.3 Terms
I was running wordpress 2.0.5 since 2 years and did not get time to upgrade to Wordpress 2.3.
So I decided last week to upgrade to Wordpress 2.3 and I did. I upgrade the same way how wordpress advice us here.
After installation, I did notice it has migrated my categories tables to wordpress 2.3 Terms tables but nothing migrated from Tags tables. I was surprised! Did I make any mistake? Then it comes into my mind, it is Ultimate Tag Warrior plugin, which has created those tables for me not Wordpress.
Now I had to migrate those tags from Tags table to Terms tables. So I wrote a script that does that job for me. I thought let me make that available to you, if someone would like to extend the script and build a smart plugin!
I would like you to read this before you use this script:
- Take backup of your database. It is not going to delete anything in the database though.
- Make sure you have Tags tables from Ultimate Tag Warrior in your database.
- Since Unique index created on slug column in Terms table, this script will add ‘2′ add the end of tag if any duplicate key/slug found in the Terms table.
- Set MySQL Connection parameters in this file.
- Upload it to your server and run it. Just run it once!
- Do no forget to share your feedback via comments!
If you would like to look at it and review/install, please download PHP Code here.
March 12th, 2008 at 10:18 am
Thank you for your script. It saved me a lot of time. The only thing is, that it has problems with german umlaut. But that is only a little problem since now I don’t have to convert the tags myself.
July 30th, 2008 at 1:07 pm
Excellent! Thanks.
I had to update the script to work with 2.6 — the table structure had changed for wp_term_relationships. So the insert need another value:
INSERT INTO
wp_term_relationships
VALUES
(“.$objectFetchRow["post_id"].”, “.$termsTaxonomy_id.”, 0)”
I also tried to recode the script to avoid the duplicate terms (pointing them back to existing terms), but this script didn’t work, and i didn’t have the patience to debug it…
August 8th, 2008 at 4:25 pm
it looks like a nice site, thanks..
September 30th, 2008 at 3:08 am
LOL
that doesn’t even make any sense!
October 5th, 2008 at 12:43 pm
Thank you for the nice post. I liked also your theme colours.
October 20th, 2009 at 8:45 am
What tamplate do you use in your blog? Very interesting articles
Thanks for your comment. I was using different (free) themes available on internet and then end up using my own site’s design.
October 23rd, 2009 at 12:57 pm
Excellent article, bookmarked for future referrence
December 3rd, 2009 at 11:41 am
Considerably, the article is in reality the freshest on this worthwhile topic. I agree with your conclusions and will thirstily look forward to your forthcoming updates. Saying thanks will not just be sufficient, for the fantastic clarity in your writing. I will at once grab your rss feed to stay privy of any updates. Pleasant work and much success in yourbusiness enterprize!