• Moshu
  • Prairie
  • WordPress
  • The combined blog: about WordPress, the Canadian Prairies and myself
    The Journey to full time blogging

How to merge two old WordPress blogs

As I mentioned in my welcome post at this new location, there are two older blogs here – merged in one database. I remember questions about how to do it in the WordPress forums, so I thought I should document the process for the benefit of other bloggers that want to do the same.

First of all, let’s take a look at the situation how it was before the merge. The two blogs were located at another domain in a setp like this:

As you can see: one was in a subfolder and the other one in a subdomain of the same domain. Actually, it doesn’t really matter where the old installations were, I am just describing the exact situation. had installed WP 2.3.3 (I even posted about not being able to upgrade because of some plugin incompatibilities…); on the other hand had an older version, WP 2.0.11.

Back up everything

This should be your very first and most important step. I didn’t really care about the WP files, themes and plugins because I always have a backup copy of all my themes, and I also have all the plugins I ever downloaded on my machine. Which means I focused manily on backing up both databases. I am not using any plugin for this, just the good old method of going into the database with phpMyadmin offered by my host(s) and running Export for the tables I need. There are very detailed instructions in the Codex regarding the backup, please read them carefully before attempting anything!
At the end of this step I ended up with two .sql files on my hard drive.

Working with the databases

I have XAMPP installed on my computer, which means I can run locally WP installations. Actually, I have more than one version installed and running, so I can visit localhost/2011 or localhost/251 and check the behaviour of different versions locally.
I opened the local phpMyadmin (the one installed with XAMPP) and imported the 2.3.3 database I just saved above into one of the databases. In order to be able to see it, quickly edited the home and site_url values in the abc_options table. Then I opened the wp-config.php file of my local /251/ folder for editing — I always use PSPad to edit files — and pointed the installation to the newly imported 2.3.3 DB. When trying to open the admin dashboard, it promted me to update the database… meaning now I had the DB of my old-blog-1 upgraded to WP 2.5.1. Checked, everything worked fine, except the image paths – but we will deal with that later.

Next, I imported the 2.0.11 DB into another local database (although I could use the same one, since the tables had different prefixes). Then I opened the wp-config.php file of my local WP 2.0.11 and edited it to point to this database. Again, edited the home and site_url in the options table to see how does it look like. Good. Just to make things clean, I had another WP 2.5.1 install in a folder 251a/ and now I edited its wp-config file to point to this 2.0.11 database. Again, when trying to go into this dashboard, it promted me to upgrade, which I did (and edited the options table in the DB).

At this moment I had 2 local blogs, both upgraded to version 2.5.1.
I know it may sound complicated but it isn’t, basically you work in five tabs: blog1 frontend, blog1 backend, blog2 frontend, blog2 backend, local phpMyadmin.

The merge

Having now the latest WP on both installation it was quite easy from here: both installations have the Export/Import feature under Manage. In earlier versions that don’t have the Export feature, the whole process would have been much more complicated because doing a MySQL import of WP tables over an existing installation can create a lot of troubles: if you have different prefixes they just don’t “merge”, and if the prefixes are the same, it gets even worse… so, you would need to edit the .sql file(s) which is quite a PITA.
What I did: knowing the the old-blog-2 had less posts (would be a smaller file), I went to the second local blog and clicked on Export and saved the resulting WXR file. Next, went to the dashboard of the first local blog (used to be old-blog-1) and clicked on the Import. When asked, located the above mentioned WXR file and gave it a go.

In a few moments I had in blog1 all the posts, comments, categories etc. from both old blogs.

Final adjusments

These steps might be optional, depending on your merged blogs.
I needed to re-arrange the (post) category hierarchy: ordering some categories as child of another, and also renaming some of them. All this was done in the admin panel under Manage > Categories. (I also needed to re-group some posts, i.e. moving from one category to another, but since it involved only a few posts, I could do it manually, one by one.)
I did a similar clean-up with the Links and Link Categories, too.

A more annoying thing is having all the image codes pointing to the old URLs, practically having all the images broken in all posts. First I took care of the image files. As I mentioned, these were old blogs, so one of them even had a wp-images folder, the other had the wp-content/uploads/ although some pictures were stored there, other in year/month/ folder – depending on the version that existed at the time they were uploaded. Accessing both old blogs with FTP I downloaded all the pictures in exactly the same folder structure as they were there into the WP 2.5.1 local installation.
Next, I installed the Search and Replace plugin – a life saver, if you ask me! And ran two “replace” queries: replace the portion of the old URLs which makes the images inaccessible. As a real life example: replace
with in the _posts table. This will affect only the first portion of those image paths, regardless of the rest, which could be /wp-images or wp-content/uploads/2007/03 etc.

Finally, I made a backup (export) of this database and imported it to the DB at this server where is hosted. Set up a password protect until ironed out small issues with the theme and the general setup, uploaded all the images as described above, created some new Pages, checked the menu system… and we were good to go live.

7 Responses

  • George ·

    Moshu, can you tell me the steps in installing *other* WordPress versions under Xampp? (You answered a query I posted in the WordPress Forum, saying it could be done, but even with the innumerable posts showing how to install ONE version, I’m not sure just how to install other versions.


  • Moshu ·

    Hey George,

    It is relatively simple. With XAMPP your root folder is “htdocs” – which will show anything uploaded there, when you open “localhost/something” in your browser.

    So, under htdocs I have created different subdirectories (could be anything but I did it in this way to keep track): /2011/ or /231/ or /25/ or /251/ etc. – and I put the content of the downloaded and unzipped version packages in the proper directory.

    Edit the wp-config… i.e. follow the usual install routine for each.

    Which is the part that gives you difficulties?

  • George ·

    Thanks for the speedy reply! The part that gives me difficulties is my low i.q…I will give it a try and get back to you with more questions, or if I’m succesful, to thank you again for your help. ;-)

  • Tony ·

    Thanks for the post I wish you the best!

  • Kashif ·

    Thanks for this idea!

  • Shaun ·

    I’m finding this a bit of a nightmare trying to merge my wedding video blog with my wifes wedding photography blog. Your post has helped make it somewhat simpler and I will give it ago as soon as I get my head around it.

  • Avangelist ·

    The concept for merging databases is fairly straight forward. The more complex aspect is merging the files directories for images, videos etc and then updating the database paths to the files.

RSS feed for comments on this post.   TrackBack URI

Leave a Reply

Do something different
with your WordPress site!

Build SILOS and get in Google's Goodbooks
Here is how to make them LOVING your site:

Silo Manual

(click on the silos!)

Get the free siloing manual
and beat your competition today!

  • Make and save money!
Hassle-free blog setup in minutes   Click here to join Easy Video Producer
RAP Bank   Text Link Ads