- How to migrate WordPress multisite sub-site to sub-site with WP Migrate DB Pro
They say it can be done, but not directly right now. The workaround is multisite > single site > multisite. So you need an intermediary WordPress install to do this.
License required? Developer license, which is the lowest license level that includes the (necessary) Multisite Tools Add-on.
LINK TO COMPARISON OF MIGRATION PLUGINS POST
To do this you need to have the following sites set up:
This is the multisite installation containing the sub-site you want to transfer.
A temporary, standalone, single site install of WordPress, we’ll use as an intermediary transfer site. This should be a clean install, used for the purpose of transferring this site only.
This is the target multisite installation the sub-site will be added to.
This copy can then be restored to quickly reset the site for another transfer without having to reinstall everything each time.
We’re going to explain below how to do both steps of the migration process and changes to the database necessary to enable a successful migration using WP Migrate DB Pro:
- Source multisite to intermediary single site
- Intermediary single site to target multisite
Hopefully it’ll be simple, but as well go through the process and plugin settings step-by-step, this may be a long post. At the end, we’ll summarise the steps and where they differ for the two migrations for reference.
To keep things a little more concise – we’ll refer to the intermediary single site as the ‘transfer site’. That’s the one in the middle.
Source multisite → transfer site
Let’s step through this first part of the process, setting up the WordPress site environments on the first two servers, the database and the plugins. But not necessarily in that order…
1. Prepare the source multisite
On your source multisite installation, install and network activate the WP Migrate DB Pro plugin in My Sites > Network Admin > Plugins.
Once network activated, go to Settings > WP Migrate DB Pro. This will take you to the Migrate tab of the plugin settings, which we won’t need for this migration, as these options will be set from the transfer site. Let’s get the other settings established though.
Note, with WP Migrate DB Pro there’s no save button for the settings. They will be saved automatically when you make a change.
1.1 Settings tab
Select the Settings tab, and let’s take a look at these from the top.
- First is the connection info for this site. We’ll use this when we’re ready to migrate, but for now let’s move past that and come back to it later.
- Permissions can be enabled for Pull. For security, the plugin lets you separately set whether data can be overwritten on the current site (Push) or be transmitted to another site (Pull).
- Your License needs to be entered here to activate the plugin. This is necessary to support the features we’re about to use.
- Request Settings
ADD MORE DETAIL HERE
ADD MORE DETAIL HERE
ADD MORE DETAIL HERE
ADD MORE DETAIL HERE
Advanced Details – leave them
1.2 Addons tab
Next, select the Addons tab. You need to download, install and activate the following add-ons:
This will bring featured images and other media associated with the site across automatically and assign it to the newly migrated site.
This is necessary to support the migration of an individual sub-site instead of single sites alone.
This ensures that the active theme and plugins used by the sub-site are also migrated to the new site without installing them manually first.
For each of the add-ons in turn, follow this process:
- Click Install. A new page will load.
- Click Activate Plugin.
- Return to the Addons tab.
If they’re not available, check you have purchased the correct license, or contact Delicious Brains support for assistance. They’ll be happy to help.
Before we move on, you may want to keep this site open in one tab while you prepare the transfer site, so you can refer to both during the process. But that’s enough with the source multisite for now. We’ll come back to it when we’re ready to perform the first transfer.
2. Prepare the transfer site
You should have a fresh WordPress install on the transfer site, so the only thing that needs to be done is to install and configure the plugin here as well.
Install the WP Migrate DB Pro plugin and activate it. Once, activated, let’s perform similar actions on this site, ready to receive the migration.
Go to Tools > WP Migrate DB Pro.
2.1 Settings tab
Select the Settings tab and let’s step through the settings here as well.
- Connection Info won’t be used here for this migration, so we can ignore this.
- Permissions need to be enabled for Push but not for Pull.
- Your License of course needs to be entered on this site as well.
- ADD MORE HERE
ADD MORE HERE
ADD MORE HERE
ADD MORE HERE
2.2 Addons tab
This is exactly the same as the process involved in 1.2 above. Follow that again on this site, then come back for 2.3.
2.3 Migrate tab
Now go to the Migrate tab, and the first setting we need to change is to select Pull from the options at the top of the page.
This prompts us for the connection info from the other site, so briefly return to the tab you kept open for the source multisite and go to the Settings tab there. Click the Copy to Clipboard button under the connection info and return to the transfer site Migrate tab.
When you paste, there should be no need to click Connect, the plugin will automatically detect the pasted info and connect automatically. All the other migration settings will be set here, from the site pulling the data.
Once the connection is established, a new checkbox will appear beneath the radio button options, Pull from a specific subsite. Check that box, and you’ll get a dropdown of the sub-sites available on the source multisite server. What’s really nice here is that it’s not a horrible list of site IDs you have to reference from the network sites list, but a handy list of the sub-site URLs for you to choose from. They’re also in order of creation, with the oldest at the top. Find the site you want to migrate and select that.
After you select a sub-site, a message will appear in grey underneath the selection to let you know if the database table prefix on the transfer site will be changed during the migration, and what the new prefix will be. The transfer site will inherit the prefix from the source multisite database.
Next, the Find and replace section lets you incorporate your own changes text during the migration and comes with a couple of lines already added. The first line “will find the domain name of your remote site and replace it with the domain name of this site… [leaving] out the protocol so that both http:// and https:// will be found and replaced”.
The next line “is mostly for 3rd party plugins that store the website’s root file path in the database. This set of fields will ensure that these values are updated to the correct root file path during the migration”.
Either of the predefined lines can be deleted using the icon to the right, and you can add your own lines and reorder them using drag-and-drop with the horizontal line icon to the left. The one exception is the top line cannot be moved, and you cannot edit the domain name of the target transfer site. If you want to use this feature further, it’s worth reading the Delicious Brains documentation on Find & Replace.
This is a really useful feature, but for this example, you should be able to leave the two default find and replace lines.
Tables (all selected by default)
Exclude Post Types works the opposite way to Tables above. By default all post types are included, so enable this if you want to select which post types to exclude. We’ll leave this unchecked and move on.
Advanced Options are self explanatory. Read the note about the first option Replace GUIDs. We’ll leave this all default.
Backup the local database before replacing it gives you the handy option to create a .sql file of the transfer site database before the migration. If you’re using a clean site, this shouldn’t be necessary. Also if you followed our tip to reuse the site, you won’t need this.
The Media Files checkbox is enabled by installing the Media Files add-on, and provides the following three options:
Compare remote and local media files determining what files are missing or have been updated and need to be downloaded. Great for syncing two Media Libraries that only differ a little.
Same as the first option, but also removes any local files that are not found in your remote Media Library. Any files in the uploads folder that are not part of the Media Library will remain untouched.
Removes all files in the local uploads folder and downloads all files in the remote uploads folder that are in the Media Library.
If you’re using a clean site anyway and want a clean migration, the most ruthless option is to select the third option.
The next two checkboxes, Theme Files and Plugin Files were enabled by installing the Theme & Plugin Files add-on.
Check both, and select the themes and plugins you want to migrate with the site.
If you’re using a child theme, you will need to select both the child and parent themes at this point. Select multiple items in the list by holding CTRL (PC) or ⌘ cmd (Mac) and clicking.
For plugin files, you can opt for the easy route and select everything, or you can refer to your source sub-site’s plugin page and elect to only transfer the plugins that are network activated or locally activated (since those are the only ones that are strictly necessary). Depending on the number of plugins installed, the latter can be an arduous manual process you may want to do without, and for the purposes of this example, we’ll select all using the handy Select All link under the plugin list.
The Exclude Files option allows you to specify any files in the file system you would like to ignore, and includes some by default. If you have any files stored which are not part of your WordPress installation for example, such as:
- Domain verification files from Google Analytics or an SSL certificate provider
- Files stored in the web root folder for serving via the same domain
- Large backup files from backup plugins that don’t need to be transferred
Unless you know of any such files, again, this can be left as default.
The final option allows you to Save Migration Profile for all the settings on this page in order to reuse them another time. The option is yours.
2.4 Migration time
With everything now set on the transfer site, we can now initiate the pull from the source multisite.
Double-check you’re happy with the settings in the transfer site Migration tab. If so, click Pull.
You’ll now be presented with the progress window.
ADD SCREENSHOT HERE
ADD MORE DETAIL ABOUT EXPANDING THE VIEW, PAUSING AND CANCELLING
TIP: MAKE SURE THE PLUGIN AND ADDONS ARE UP-TO-DATE ON ALL SERVERS (ESPECIALLY IF YOU’VE ALREADY GOT IT INSTALLED)
Of course, depending on the size and complexity of your site, the sections that may take the longest to migrate are media and plugins. This will be affected by the options you selected in the Settings tab under Request Settings, but if you’re in no rush – just be patient.
Hopefully you won’t encounter any errors.
2.5 Post migration
When the migration is complete you’ll be logged out of the transfer site because the database has changed, so remember to login using credentials from the source multisite.
For completeness, it’s worth logging in from scratch at transfersite.com/wp-admin to get a fresh look at the Dashboard.
It’s also important that you check the site front-end as well, to ensure it all appears correctly, that the themes and plugins have come over and been activated and there’s nothing glaringly out of place.
For example, on reviewing one site migration I discovered that (for some reason) the WP and Divi Icons Pro plugin was migrated across but wasn’t activated, causing some external icon libraries to not be loaded and therefore missing icons.
Transfer site → destination multisite
Hopefully everything went smoothly with the first migration. Now it’s time to do it again, but a little differently this time.
The process is, of course, the same overall, but to keep this post a little shorter we’ll just highlight the considerations and differences with this second migration. Otherwise, as the newly migrated transfer site already has the WP Migrate DB Pro plugin installed, begin by installing WP Migrate DB Pro and its add-ons on the destination multisite, then follow steps 1.1 – 2.5 above.
3. Prepare the destination multisite
First of all, the migration into a multisite sub-site will require a target site to already exist, so you’ll need to begin by creating that first. We can’t tell you how best to do this, this will depend on your setup and your own processes, but as long as a sub-site exists to receive the migrated site data, you should be good to go.
For security, start by going to the ‘old’ source multisite and turning off Pull permissions in the plugin Settings tab. This prevents any unauthorised or accidental migrations of data, however unlikely.
Equally, on the transfer site, turn off Push and turn on Pull.
3.1 Migrate tab
There shouldn’t be anything to change on the other tabs on the destination multisite, so let’s go straight to the Migrate tab and get started.
After you’ve selected Pull and pasted in the connection info, Pull into a specific subsite and select the appropriate site (probably the one you recently created in step 3).
Leave other settings default until you get to Backup the local database before replacing it. This is probably a good idea (see STOP notice below) but you can take a backup whichever way you see fit. If you use the built-in database backup option here in the plugin, it will add a backup step prior to the migration process, and will store the backup file on the server in the /wp-content/uploads/wp-migrate-db-pro directory.
LINK TO BACKUP PLUGIN POST
The Media Files you should select and choose Compare then download.
With Theme Files you should migrate the active theme. If it’s a child theme, you only need to migrate the parent if it’s not already on the server. If in doubt, migrate it anyway.
For the Plugin Files this is where it differs a bit. Usually, you’ll be migrating to a multisite that’s already up-and-running, and probably already has the plugins on there. The way the Theme & Plugin Files add-on works is to overwrite those files on the destination server if they already exist. (Delicious Brains has confirmed to us that this is staged first, so if there’s a failure, it can roll back gracefully.) But, if this is your live environment you’re migrating to, you may want to be very careful about bringing across all plugins.
Rather than elect to migrate all the plugins from the transfer site to the destination multisite, you could – depending on your circumstance – either copy none of them, or you could manually check which ones are on the transfer site but not on the destination site, and only copy those over. That’s a bit of a pain and it would be nice for the plugin to have an option to automatically only copy over plugins that don’t exist, or maybe an overwrite toggle. But anyway, take your pick.
Here, we’re going to copy over that WP and Divi Icons Pro* plugin we’re using from Divi.Space because that needs to come across from where we started using it in development on this occasion. There are possibly other plugins from the source multisite server we don’t want migrated yet, so that’ll work.
Before initiating the migration, it’s highly recommended that if your destination multisite is a live environment, you really should take a backup first. Even if it’s not live, it’s still a good idea.
Did we mention taking a backup? You’ve done that, right?
Okay. Then it’s time to click that Pull button.
Aside from the final checks (refer to step 2.5 above again), that should be it. You won’t be logged out this time, because the database migration adds tables for the new sub-site, rather than replacing the whole thing. Everything should have gone fine.
If you plan to use this process repeatedly, it’s worth having a transfer site available, ready to go, with a fresh WordPress install and WP Migrate DB Pro already installed, then backed up so you can restore it after each migration.
When you’ve undertaken this process once, it’s fairly straightforward. Delicious Brains are not only continuing to develop the plugin, adding features and providing further add-ons, but they are also available to provide great support when you need them.
One of those features will be a method to directly migrate a sub-site from multisite to multisite without the need for an intermediate single install transfer site. We don’t know when to expect that, but we’ll be sure to update this post when it happens.
So if you have a question, feel free to login to your Delicious Brains account and start chatting.
In the meantime, if you’re going through multisite migration processes – maybe in slightly different scenarios than this – you may want to check out the other posts in this series and evaluate which multisite migrations tools might suit your needs best.
Let us know if this has helped you with your first sub-site to sub-site migration, or if you’re a seasoned veteran and use a different method… please tell us in the comments.