Merging two or more of anything (banks, lanes of traffic, airlines, train tracks, families, etc.) can quickly and easily lead to trouble. And merging two or more WordPress sites is no exception. But there are some steps you can take to make this process cleaner and easier to manage.
In this post, we’ll go over these steps by running through a hypothetical example. And while your own merger may be a lot more complicated than this, the basic principles we’ll go over here should still help you when confronting what might at first look like chaos.
OK, so let’s get merging.
Let’s say you have a site about dogs and a site about cats. You decide you want to merge these two sites and make one larger site about pets in general.
You can merge sites easily enough by using the WordPress import/export tools. And while that might be fine in a lot of cases, depending on what types of content you have and what you want to achieve, doing a simple, automatic merge might create some problems for you.
A Simple Problem Example
Here’s a simple example of a potential problem. What if you have a category on your Dog site titled “Toys.” And you also have a category on your Cat site titled “Toys.” When you import those sites into one larger site, then all the “dog toy” posts and all the “cat toy” posts will get merged into one category called “Toys.”
But what if you don’t want that? What if you want a “Dog Toys” category and a “Cat Toys” category? Or what if you want those two categories to be subcategories of a main category called “Toys”?
If you do an automatic merge, then it’s not easy to tell the dog toy posts from the cat toy posts. While you might be able to read the titles and tell the difference (maybe), you’re still in no position to easily and automatically separate all the dog toy posts from the cat toy posts.
One solution to solve this particular problem would be to go to your Dog site and rename the “Toys” category to “Dog Toys.” Then go to your Cat site and rename the “Toys” category there to “Cat Toys.”
When you export your categories for each site, then the toy categories will be named to set them up the way you want on the new site.
For that particular situation, this solution might be fine. But you might have a more complicated situation than that. Or you may find that once you import each of your sites into the new site that there’s something you didn’t think of before. And now that you’ve merged everything together, it’s going to be harder for you to get that done.
Another reason to maybe not go this route is that it’s probably a good idea to leave original sites in their original state as much as possible until the merger is completely and absolutely done. Of course you can make a backup of your original sites, but even backups don’t always play nice when trying to reinstitute them.
A Better Solution
Therefore, if you have a situation that might be a little complicated, a better solution would seem to be importing the content from each original site and giving it some kind of unique identifier. This unique identifier would be even more valuable if you could use it to easily sort your posts in various ways.
WordPress already employs a very useful “tag” that can act as unique identifier – the post author.
If you’re merging two of your own sites, however, then there’s a good chance you use the same username on both sites. Or even if the two sites are not your own, there’s a chance that both sites use the main username “admin.”
(Note: For security purposes, it’s best not to use the easily-guessable name “admin,” but that’s another story. Many people do use it.)
For this example, let’s say you use the username “admin” for each of your sites. The solution then would be to create two new users on the site where the merger is happening (i.e. the general Pets site). Identify each new user by something relevant to the original sites – e.g. make one user named “dog” and one user named “cat.” When all this is over, you’ll be deleting those new users.
To make a new user, go to Users > New User. Unless you’ll be keeping those users for some reason, it doesn’t really matter what their user role is (Admin, Editor, etc.).
Manually Creating Users is Better
While the WordPress importer gives you the option of creating a new user during the import process, I recommend creating the new user manually before you begin importing. During testing, I had the new user creation function fail on me. And instead of stopping the process, the importer went ahead and imported the posts and simply assigned them to the default admin.
Now, the truth is I was trying to do something a little tricky and attempted to assign two users’ posts to the same new user, and so that’s probably what caused the malfunction, but it doesn’t hurt to do things the safer way and create the new user first.
Users on Your New Site
OK, so at this point in our example case (before we actually import), we have two new users (“dog” and “cat”) on the site we’re moving the Dog and Cat sites to (i.e the general Pets site). Of course we also have the admin for the new site. We’re going to name that user “pets,” so as to stay away from the username “admin.”
Export Your Sites to Your Computer
In order to merge your Dog and Cat sites into your Pets site, you’ll first need to export the content of your Dog and Cat site to your computer via an XML file.
Go to Tools > Export
You’ll also notice that you have the choice of exporting only posts or only pages. If you choose posts, you will then also have a number of other choices, such as exporting only posts from a certain category or a certain author.
Import Your Sites to Merge
Once you have your export file(s) on your computer, go to the site where you will import them to (in our example, the Pets site). Go to Tools > Import > and choose WordPress from the list.
Unless you’ve done this before, when you click on the WordPress link, you will be prompted to download the WordPress Importer plugin. Go ahead and do that. Then activate it and run it.
You’ll then be presented with a screen where you can upload the XML file(s) you just downloaded to your computer (i.e. the content from you Dog and Cat sites). When you browse and upload that file, you’re then presented with a screen where you can assign all that content to a previously existing user.
*It’s here that you want to choose to assign that content to a different user.
For example, let’s say I’m uploading the content from my Dog site. I’ll choose the user “dog” that I previously created.
Sorting Posts by Users
OK, now that you have the content from your sites imported and assigned to different users, there are a few different ways you can sort the posts by user (i.e. sort it by each original site).
One way is to go to Users > All Users, and then click on the number in the right-hand column that shows the number of posts for that user.
Another way is to go to Posts > All Posts, and then click on the username of the author you want.
Once you do that, you will be in a screen that has only posts from the author with the name “dog.” In other words, those will be all your posts from your original Dog site.
From there, you can do whatever you might need to do to them. Some things you may be able to do with the bulk editor. Some things will still require manual action on each post, but you will at least have them separated out on that screen, and you will know that all of those posts are from the Dog site.
Using the Bulk Editor
Let’s say you’d like to change the “Toys” category on your Dog posts to “Dog Toys.” You can do that, at least in part, with the bulk editor.
First you’ll need to create your new category (Dog Toys). Do that by going to Posts > Categories.
Still on the author page we talked about above, select all the posts by the “dog” user that also have the “Toys” category. Then select “Edit” from the dropdown menu at the top, and click “Apply.”
*Helpful Hint: If you have a LOT of posts and many categories, you can also sort by author AND category with the following trick.
Append the author name and the category name to the end of your URL after /edit.php/. In our example, our author name is “dog” and the category we want to separate out is “toys.” So this is what I would append to the end of the URL:
In other words, the full URL would look like this:
From this screen you can assign all those posts to another category (our newly created “Dog Toys”). Remember to click “Update” in the bottom right-hand corner.
While the bulk updater will allow you to add all the posts to a new category, unfortunately it won’t allow you to remove post in bulk from a category. And so you will see that your posts are now in the newly created category (“Dog Toys”), but they’re also still in the old category (“Toys”).
Of course you can manually edit each post, and delete each one from the Toys category.
But there is another solution. Once you have ALL your posts moved into either the Dog Toys or the Cat Toys category, you can simply delete the Toys category altogether. (Go to Posts > Categories > mouse over the category and delete it.)
Finishing Up Your Editing
Changing categories is only one of a number of things you can do. You can also do things such as bulk add tags to any number of posts you like.
After you get all your editing done, you can then assign all the posts to one user (e.g. the admin of the Pets site). Again, you can do that through the bulk edit function.
When that’s accomplished, you can then delete the newly created “dog” and “cat” authors.
Think Through Your Merger
The above example is but one relatively simple and common issue people may run into when merging sites. Some people, however, may have very complicated situations. And so merging is not something to jump into without thinking about a little first.
Leaving your original site in its original state for the time being, and importing its content with a unique identifier (i.e. under a unique username) will help you to put a buffer into the merger process.
You never know what types of issues might crop up that you didn’t think about beforehand.