{"id":116478,"date":"2013-06-03T11:30:30","date_gmt":"2013-06-03T15:30:30","guid":{"rendered":"http:\/\/wpmu.org\/?p=116478"},"modified":"2013-06-03T12:02:45","modified_gmt":"2013-06-03T16:02:45","slug":"merging-wordpress-sites","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/merging-wordpress-sites\/","title":{"rendered":"How to Merge WordPress Sites and Avoid Creating a Mess in the Process"},"content":{"rendered":"<p>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.<\/p>\n<p>In this post, we\u2019ll 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\u2019ll go over here should still help you when confronting what might at first look like chaos.<\/p>\n<p>OK, so let\u2019s get merging.<\/p>\n<h2><strong>Our Hypothetical <\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"dog-cat-bench-800px\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/dog-cat-bench-800px.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"800\" height=\"453\" \/><\/p>\n<p>Let\u2019s 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.<\/p>\n<p>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.<\/p>\n<p><strong style=\"font-family: ff-tisa-web-pro, Arial, sans-serif; font-size: 30px; line-height: 36px;\">A Simple Problem Example<\/strong><\/p>\n<p>Here\u2019s a simple example of a potential problem. What if you have a category on your Dog site titled \u201cToys.\u201d And you also have a category on your Cat site titled \u201cToys.\u201d When you import those sites into one larger site, then all the \u201cdog toy\u201d posts and all the \u201ccat toy\u201d posts will get merged into one category called \u201cToys.\u201d<\/p>\n<p>But what if you don\u2019t want that? What if you want a \u201cDog Toys\u201d category and a \u201cCat Toys\u201d category? Or what if you want those two categories to be subcategories of a main category called \u201cToys\u201d?<\/p>\n<p>If you do an automatic merge, then it\u2019s 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\u2019re still in no position to easily and automatically separate all the dog toy posts from the cat toy posts.<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<h2><strong>One Solution<\/strong><\/h2>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-right cgrid-col-span-3\">\n<div class=\"cgrid-col-wide-right\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-ratio-3-2 wp-image-116498\" title=\"kitten-playing-470px\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/kitten-playing-470px-448x412.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"448\" height=\"412\" \/><\/div>\n<\/div>\n<\/div>\n<p>One solution to solve this particular problem would be to go to your Dog site and rename the \u201cToys\u201d category to \u201cDog Toys.\u201d Then go to your Cat site and rename the \u201cToys\u201d category there to \u201cCat Toys.\u201d<\/p>\n<p>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.<\/p>\n<p>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\u2019s something you didn\u2019t think of before. And now that you\u2019ve merged everything together, it\u2019s going to be harder for you to get that done.<\/p>\n<p>Another reason to maybe not go this route is that it\u2019s 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\u2019t always play nice when trying to reinstitute them.<\/p>\n<h2><strong>A Better Solution<\/strong><\/h2>\n<p>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.<\/p>\n<p>WordPress already employs a very useful \u201ctag\u201d that can act as unique identifier \u2013 the post author.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116497\" title=\"dog-with-toy-700px\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/dog-with-toy-700px-700x293.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"293\" \/><\/div>\n<\/div>\n<p>If you\u2019re merging two of your own sites, however, then there\u2019s a good chance you use the same username on both sites. Or even if the two sites are not your own, there\u2019s a chance that both sites use the main username \u201cadmin.\u201d<\/p>\n<p>(Note: For security purposes, it\u2019s best not to use the easily-guessable name \u201cadmin,\u201d but that\u2019s another story. Many people do use it.)<\/p>\n<p>For this example, let\u2019s say you use the username \u201cadmin\u201d 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 \u2013 e.g. make one user named \u201cdog\u201d and one user named \u201ccat.\u201d When all this is over, you\u2019ll be deleting those new users.<\/p>\n<p>To make a new user, go to Users &gt; New User. Unless you\u2019ll be keeping those users for some reason, it doesn\u2019t really matter what their user role is (Admin, Editor, etc.).<\/p>\n<h2><strong>Manually Creating Users is Better<\/strong><\/h2>\n<p>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.<\/p>\n<p>Now, the truth is I was trying to do something a little tricky and attempted to assign two users\u2019 posts to the same new user, and so that\u2019s probably what caused the malfunction, but it doesn\u2019t hurt to do things the safer way and create the new user first.<\/p>\n<h2><strong>Users on Your New Site<\/strong><\/h2>\n<p>OK, so at this point in our example case (before we actually import), we have two new users (\u201cdog\u201d and \u201ccat\u201d) on the site we\u2019re 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\u2019re going to name that user \u201cpets,\u201d so as to stay away from the username \u201cadmin.\u201d<\/p>\n<h2><strong>Export Your Sites to Your Computer<\/strong><\/h2>\n<p>In order to merge your Dog and Cat sites into your Pets site, you\u2019ll first need to export the content of your Dog and Cat site to your computer via an XML file.<\/p>\n<p>Go to Tools &gt; Export<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116482\" title=\"export-conetnt\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/export-conetnt-700x563.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"563\" \/><\/div>\n<\/div>\n<p>You\u2019ll 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.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116483\" title=\"choose-category\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/choose-category-700x404.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"404\" \/><\/div>\n<\/div>\n<h2><strong>Import Your Sites to Merge<\/strong><\/h2>\n<p>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 &gt; Import &gt; and choose WordPress from the list.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116484\" title=\"import-wordpress\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/import-wordpress-700x372.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"372\" \/><\/div>\n<\/div>\n<p>Unless you\u2019ve 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.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116485\" title=\"importer-plugin\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/importer-plugin-700x348.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"348\" \/><\/div>\n<\/div>\n<p>You\u2019ll 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\u2019re then presented with a screen where you can assign all that content to a previously existing user.<\/p>\n<p><strong>*It\u2019s here that you want to choose to assign that content to a different user.<\/strong><\/p>\n<p>For example, let\u2019s say I\u2019m uploading the content from my Dog site. I\u2019ll choose the user \u201cdog\u201d that I previously created.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116487\" title=\"assign-to-dog\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/assign-to-dog-700x421.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"421\" \/><\/div>\n<\/div>\n<h2><strong>Sorting Posts by Users<\/strong><\/h2>\n<p>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).<\/p>\n<p>One way is to go to Users &gt; All Users, and then click on the number in the right-hand column that shows the number of posts for that user.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116489\" title=\"select-dog-posts\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/select-dog-posts-700x182.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"182\" \/><\/div>\n<\/div>\n<p>Another way is to go to Posts &gt; All Posts, and then click on the username of the author you want.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116490\" title=\"select-dog-posts-user\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/select-dog-posts-user-700x262.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"262\" \/><\/div>\n<\/div>\n<p>Once you do that, you will be in a screen that has only posts from the author with the name \u201cdog.\u201d In other words, those will be all your posts from your original Dog site.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116491\" title=\"only-dog-posts\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/only-dog-posts-700x247.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"247\" \/><\/div>\n<\/div>\n<p>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.<strong>\u00a0<\/strong><\/p>\n<h2><strong>Using the Bulk Editor<\/strong><\/h2>\n<p>Let\u2019s say you\u2019d like to change the \u201cToys\u201d category on your Dog posts to \u201cDog Toys.\u201d You can do that, at least in part, with the bulk editor.<\/p>\n<p>First you\u2019ll need to create your new category (Dog Toys). Do that by going to Posts &gt; Categories.<\/p>\n<p>Still on the author page we talked about above, select all the posts by the \u201cdog\u201d user that also have the \u201cToys\u201d category. Then select \u201cEdit\u201d from the dropdown menu at the top, and click \u201cApply.\u201d<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-ratio-large wp-image-116492\" title=\"bulk-edit\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/bulk-edit-700x288.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"288\" \/><\/div>\n<\/div>\n<p>*Helpful Hint: If you have a LOT of posts and many categories, you can also sort by author AND category with the following trick.<\/p>\n<p>Append the author name and the category name to the end of your URL after \/edit.php\/. In our example, our author name is \u201cdog\u201d and the category we want to separate out is \u201ctoys.\u201d So this is what I would append to the end of the URL:<\/p>\n<pre>?author_name=dog&amp;category_name=toys<\/pre>\n<p>In other words, the full URL would look like this:<\/p>\n<pre>http:\/\/mypetsite.com\/wp-admin\/edit.php\/?author_name=dog&amp;category_name=toys<\/pre>\n<p>From this screen you can assign all those posts to another category (our newly created \u201cDog Toys\u201d). Remember to click \u201cUpdate\u201d in the bottom right-hand corner.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-116493\" title=\"add-categories\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/add-categories.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"273\" \/><\/div>\n<\/div>\n<p>While the bulk updater will allow you to add all the posts to a new category, unfortunately it won\u2019t 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 (\u201cDog Toys\u201d), but they\u2019re also still in the old category (\u201cToys\u201d).<\/p>\n<p>Of course you can manually edit each post, and delete each one from the Toys category.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-116494\" title=\"manually-edit-categories\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/manually-edit-categories.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"256\" \/><\/div>\n<\/div>\n<p>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 &gt; Categories &gt; mouse over the category and delete it.)<\/p>\n<h2><strong>Finishing Up Your Editing<\/strong><\/h2>\n<p>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.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-116495\" title=\"add-delete-tags\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2013\/06\/add-delete-tags.jpg\" alt=\"Post image\" aria-hidden=\"true\" width=\"700\" height=\"256\" \/><\/div>\n<\/div>\n<p>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.<\/p>\n<p>When that\u2019s accomplished, you can then delete the newly created \u201cdog\u201d and \u201ccat\u201d authors.<\/p>\n<h2><strong>Think Through Your Merger<\/strong><\/h2>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>You never know what types of issues might crop up that you didn\u2019t think about beforehand.<\/p>\n<p>photo credits: <a href=\"http:\/\/www.flickr.com\/photos\/57734740@N00\/4208722530\/\" target=\"_blank\">Miss Chen<\/a>, <a href=\"http:\/\/www.flickr.com\/photos\/patgaines\/5532205643\/\" rel=\"noopener\" target=\"_blank\">Pat Gains<\/a>, <a href=\"http:\/\/www.flickr.com\/photos\/bentorode\/7500050524\/\" rel=\"noopener\" target=\"_blank\">Ben Torode<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Merging two or more WordPress sites can create chaos if you\u2019re not careful. Here\u2019s how to do it.<\/p>\n","protected":false},"author":84404,"featured_media":205566,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[640,152],"tutorials_categories":[],"class_list":["post-116478","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-authors","tag-categories"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/116478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/84404"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=116478"}],"version-history":[{"count":2,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/116478\/revisions"}],"predecessor-version":[{"id":205567,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/116478\/revisions\/205567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/205566"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=116478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=116478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=116478"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=116478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}