Help! I Need to Migrate a WordPress Multisite: A Step-by-Step Guide
Help! I Need to Migrate a WordPress Multisite: A Step-by-Step Guide
WordPress Multisite has been a highly beneficial addition to web developers’ toolboxes since its introduction in WordPress 3.0. While the multi-site network management solution can’t be used for every new web development project, it has proven itself quite valuable when all the right variables are in place.
In the Ultimate Guide to WordPress Multisite, Rachel McCollin talks about how to enable Multisite and create a network of sites from within a single installation of WordPress. If you’ve followed her recommendations, then you should have a fully functioning WordPress Multisite up and running.
But what happens when someone changes their mind and wants to move their site out of the network? Or what if you have a new idea for a site and you want to add it to the network’s umbrella of sites? Or perhaps you decided to rebrand the Multisite network altogether and now need to get all these sites over to the new domain name. What do you do when you want to migrate a WordPress Multisite?
In the following step-by-step guide, I’ll review how to complete each of the three Multisite migration types.
How to Migrate a WordPress Multisite
So, you have a WordPress Multisite, but you realize something needs to be moved around. There are three kinds of migration scenarios you might be looking at when it comes to your Multisite network:
- You want to migrate a single website into the already existing WordPress Multisite network.
- You want to migrate a single website out of the WordPress Multisite network.
- You want to migrate the entire WordPress Multisite network from one domain to another.
While you might be hesitant to start moving anything around within your network, there’s no need to be. Sure, the process will be a little more complicated than migrating a single site from one domain to another, but that’s to be expected. Follow along with the steps outlined in the three scenarios below and you’ll have your Multisite migrated in no time.
Scenario #1: Migrate Single Site into Multisite
In this scenario, you want to move a new website into your Multisite network. Awesome! Here’s what you need to do.
Back up both your single site installation as well as your Multisite network. You can do this with one of these WordPress backup plugins.
Next, deactivate all plugins on your single site WordPress installation. This is something WordPress suggests you do in case one of your plugins conflicts with the export process (which is a possibility).
Go to Plugins. Select the bulk “Deactivate” option for all your plugins.
One other thing the Codex suggests is that you delete any spam comments that were previously quarantined. There’s no need to save and carry that data over with you as it will (and should) never be used.
Within your single site installation, go to Tools and click on Export. It is in here where you will export a copy of your site’s files for easier setup on the Multisite.
Select the “All Content” radio dial button and click on Download Export File.
Save the XML file to your computer.
Log into your Multisite WordPress installation. From here, you’ll need to create a new empty site into which you can place the migrated site.
Go to My Sites > Network Admin > Sites, and then click on Add New.
Fill in the following details for your new Multisite subdomain:
- Site Address (this will be the subdomain name on the network)
- Site Title (which can be the same as it was previously)
- Admin Email
If you have questions on how to configure this, check out this guide on how to activate and configure Multisite.
Then click Add Site.
With the new site added, navigate to the new subdomain on the network. If you hover over “My Sites” in the top admin bar, you should see it there.
The first thing to do is go to the site’s Settings and edit the title and description. If it needs to differ from what it was before, you can change that now. Also, be sure to review the blog and permalinks settings. Basically, anything you want to maintain from the single site, you should update that here.
If the Multisite network does not use the same theme or plugins as the single site, you will need to set those up now.
Note that not all WordPress plugins are compatible with Multisite, so be sure that any new plugins you carry over are acceptable to be on the network.
In terms of copying them over, you can do one of three things:
- You can use a premium plugin (I’ve included a list of those below) to copy and migrate your theme and plugins.
- You can reinstall all plugin and theme files from-scratch in Multisite (at least the ones that don’t already exist).
- You can copy the files from your wp-content folder on the single site’s server and into the corresponding Multisite’s folders for this subdomain. To do this, make sure you know what the ID number is for your new subdomain.
If you’re unsure of what the ID number is for your subdomain, go out to the Network dashboard. Click on My Sites. Hover over the new site you’ve created and click Edit. Look in the address bar and you’ll see something that looks like this:
The “id=14” will provide you with the site’s ID number so that you know which database to edit in your directory.
Once your subdomain has all themes and plugins activated, configure and customize them to your liking.
Check the subdomain’s Pages, Posts, and Media for dummy content created during the new site setup on the network. If anything was created, delete it before you go importing content from the old site.
To import the data from your single site, go to Tools and click on Import. Select the WordPress option from the list. (If the tool isn’t installed yet, do that now.)
Upload your saved XML file here.
You’ll next be prompted about who you want to assign authorship to for your imported posts. You can either assign them to a current user on the network or a brand new one.
Click on the “Download and Import Attachments” checkbox and save your changes.
If there were widgets from the single site you want to move into the subdomain, you can easily do this using a plugin called the Widget Importer & Exporter.
Basically, it’s doing the same kind of export/import process as you just did for your site’s content, only just for widgets.
Follow the steps in the plugin and complete the export of your widget data.
Now, hop on over to the new subdomain on your Multisite network and give it a look. Does everything look okay?
- Are all images in place?
- Is the primary navigation the correct one?
- Does it appear that all plugins are working?
- Are there any theme customizations missed in this transfer?
- Do the blog posts all have the correct author?
- And so on.
Give your site a good look-through and make sure everything is as you expected it to be.
If you decide that you want to give the subdomain a custom domain (perhaps the old one from its previous single existence), you can use domain mapping to do this.
With your site up and loaded on the network, you now need to get rid of the old WordPress site.
If you’re not going to use a custom domain on the Multisite and the migrated single site no longer needs its own hosting, delete the WordPress site and cancel your domain and hosting account.
If you are going to use a custom domain on the Multisite, then you only need to delete the WordPress site and cancel the hosting account.
Scenario #2: Migrate Single Site out of Multisite
Here is what you need to do to complete the reverse process.
Back up your WordPress Multisite network.
Purchase a web hosting plan and domain name for your new WordPress site. (If you already purchased a custom domain for domain mapping, then the latter part of this is already done.)
Log into your new web hosting account and navigate the one-click WordPress install. From here, you can download and get started with WordPress for your new site.
You can also grab a copy of WordPress from here:
The export and import of content for migrating out of Multisite is different as you’ll need to grab that data directly from your database tables.
You can do this by logging into your Multisite’s control panel and navigating to phpMyAdmin.
In the tables that appear under the Network’s folder, find the one that corresponds with the site you want to migrate out of the network. The ID number will match the one from the process described earlier. In other words, when you look at the list of sites on your network, click on the Edit button for the migrating site, and you’ll find the ID number appended to the end of the web address.
As a reminder, it will look like this:
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Then use that ID number to select all the tables pertaining to that site. Once you’ve selected all of them, click the Export button at the top.
The file that exported will be in a .sql format. Make a copy and rename it.
You’ll now want to open it in a code editor like Atom in order to adjust your site’s domain (if it wasn’t already mapped to the custom domain). On the network, the site was referred to as:
However, when you import this into the new site, you want it to say:
Do a search and replace in the file and save your changes once all instances of the domain are updated.
You’ll need to make one more change in this file. Remember that site ID from before? Well, it should not exist when in the database tables for a single WordPress installation. So, anywhere that you find “wp_[ID number]_”, replace it with “wp_”.
Save the file once more.
Log into your new single WordPress installation. Because this site will no longer be part of a network of related sites, you’ll probably want to use your own WordPress theme and plugins here. So, go for it! Get those activated and customized before moving on to the next step.
Now, you can import the database tables from your old subdomain. To do this, log into this new website’s control panel and find your phpMyAdmin.
WordPress will have automatically created a number of database tables for you upon installation. You don’t need those duplicates here as you’re about to carry your own over. Go through and delete the following (all are preceded by “wp_”):
Once this is done, you can now click the Import button at the top.
Select the newly saved .sql file and click on the Go button.
Once you receive your successful upload message, you’re good to go.
If there were widgets from the Multisite network you wanted to copy over to the new domain, you can do so with the Widget Importer & Exporter plugin.
Take some time to poke around the Settings of your new WordPress site. Configure your site’s metadata and blog settings as you see fit.
Visit your new live website and do a full review of it to confirm that everything looks as it should. Because you’re likely starting with a new theme and trying to create a unique experience from the Multisite, you may have already taken care of customization in the plugin and theme setup. But it’s still good to review and make sure everything is in its proper place.
When you’re content with how your newly migrated site looks, you can return to your Multisite network and delete your website from the list of Sites on your Network’s dashboard.
Scenario #3: Migrate Entire WordPress Multisite Network
Lastly, let’s talk about migrating an entire WordPress Multisite network from one domain to another. It doesn’t require much in the way of installing new WordPress installations or configuring WordPress themes and plugins. Instead, this is about renaming all the backend files to reflect the new domain name of your network.
Here is what you need to do:
First and foremost, back up your Multisite installation.
If you haven’t done so already, purchase that fancy new domain name for your network and associate it with the same web hosting account that your Multisite currently lives on.
You’re going to need to edit the wp-config file in the root directory of your site. You can access this either through your File Manager or FTP.
Once you’ve located the file, click on the Edit button to open it.
Now, when you configured WordPress for Multisite, you added some code above this line:
/* That's all, stop editing! Happy blogging. */
The line you need want to update in this case is this one:
Update “yournetworkname.com” with the new domain name you want to use.
You then need to add the following two lines of code above the “That’s all, stop editing!” message:
Save your changes and exit.
The database files for your Multisite now also need to change to reflect the new domain name of the network. Log into phpMyAdmin.
From here, you’re going to need to search for your network’s database tables. Specifically, these are the ones that will require an update from the old domain name to the new one (these are all preceded by “wp_”):
- blogs > domain
- options > home
- options > siteurl
- sitemeta > siteurl
In addition, you also need to update the following tables for each of the sites that exist on the network. The pound sign (#) below is where you will see the actual site ID number.
- #_options > siteurl
- #_options > home
- #_options > fileupload_url
Once you have renamed the domain in every instance in which it appears throughout your database tables, you can save your changes and close. Your site should now be fully migrated to the new domain name.
Don’t forget to change the name of your site as well as the web address within WordPress. Any other rebranding and redesigning that needs to take place for this domain migration can be done now, too.
3 WordPress Plugins for Multisite Migration
Of course, this is WordPress and so there are plugins you can use to streamline this process. The ones that work for Multisite, however, require a paid upgrade, which is why I thought it was important to first share the manual process so you could see how relatively hassle-free that route is versus going the paid one.
That said, if you would prefer to have a premium plugin handle the migration of your WordPress Multisite (including your plugins, themes, and widgets), consider one of the following:
The free version of the All-in-One WP Migration plugin in the repository is a pretty slick tool for WordPress site migrations in general. Rather than manually manage part of the process and automate the rest, this plugin takes care of it all for you. However, if you want to open these capabilities up to your Multisite network, you’ll need to get the Pro version (see link below).
The Duplicator plugin is a backup, restore, clone, and migration plugin all in one. While, in general, you might find this handy when testing and building WordPress sites on a staging server and then migrating them over to the live site, you can also use this for Multisite migrations when Duplicator Pro is enabled.
There is also the Cloner plugin from WPMU DEV. While this WordPress plugin won’t help you migrate sites in and out of your network, it will help you move sites around within it. In general, this is a great tool if you want better control and consistency over the subdomains in your Multisite network.
A WordPress Multisite network is never set in stone. The network itself as well as the websites within it can be shifted around as you see fit–and can be done almost as easily as a single site migration from one domain to another.