So I had imported a few different blogs and other websites when i put together this one. the idea was that i could be rid of the 4 other websites or so and just have the 1. This was great in theory and i was a wordpress virgin. Everything previously used was ‘roll your own’ stuff I had written from scratch. This time I decided I would give it a go, and i stuck with it.
The importer worked brilliantly and imported blogger.com and other things all over the show. Some copy/paste was required for my own stuff, but for the most part a few well thought out SQL queries worked nicely.
My problem was that I had a couple of double up categories. Like “Facts” and “Informative”, and also “Humour” and “Funny” . I wanted to merge these together without having to manually edit every single post.
I found a few different plugins – however they were for earlier versions of wordpress. Then Apon googleing i found the following page which gave a great rundown!
Okay this is the dumbed down version for people NOT familiar with computering and SQL. Find PHPMyAdmin – its a pretty web interface thats probably installed on your server that interacts with the database.
Select your database name. Export your entire database and save it to your HDD. This is important, you might screw things up ok? No biggie if you do, you can restore it.
Now login to your WordPress backend. Click on “Categories” which shows your categories. On the right hand side of each Category it shows how many posts are in each one. If you hover your mouse over that you can see the link goes to yoururl.com/wp-admin/edit.php?cat=xxx in your status bar. If unsure then you can click the link and it will be in your URL.
The xxx is a number, That number is the category number which is the key to it all.
So find your 2 numbers of the ones you want to merge. Choose one of them as the one you want to merge into the other (ie if you have say 25 and 26 you are going to merge 25 INTO 26).
Now, heres the fun part. Updating the posts.
Open your PHPMyAdmin, click the tab at the top that says SQL. It will have a big empty box with the name at the top “Run SQL query/queries on database”
Into this box you need to type
SET `term_taxonomy_id` = xx1
WHERE `term_taxonomy_id` = xx2;
replace the xx1 and xx2 with the 2 categories you want to merge. xx1 would be the one you want to move them FROM, and xx2 is the one they are all going to move to.
If you get an error on this, by all means stop what you are doing and consult somebody else, Probably means you have that post in both categories already.
If it runs and says something along the lines of ‘complete, updated xxx posts’ then we win. Now you can remove any leftover garbage and the category. Do not run this if you have any errors.
DELETE FROM `wp_terms` WHERE `term_id` = xx1;
DELETE FROM `wp_term_taxonomy` WHERE `term_id` = xx1;
When i have xx1 here i mean use the same number you replaced earlier with xx1, the ones you moved posts out of. It should be fairly empty already.
This will not delete any posts. If all goes wrong then the most it will do is put your posts into Uncategorized.