How to Move a #WordPress #Multisite Out of a Multisite Network
There are numerous reasons why you might need to move a website which was created in a WordPress Multisite network to its own single website installation.
For example – the site became too large to be contained in the network, it needs its own IP address, a site owner is taking over management control of the website independently, your server is not capable to host efficiently your Multisite network anymore, etc.
Please note that you are not able to move the main site out of a Multisite network, as the network won’t work properly without it. I personally recommend making a duplicate website and then replacing the contents.
Before you start
Migrating a Site out of Multisite Manually
There are three parts of the you need to migrate from the Multisite Network:
- database tables—not all of the database tables but just the ones relating to this website
- uploads—you can find these in the site’s subdirectory in wp‑content/uploads/sites
If the Multisite network was created before WordPress 3.5, instead of this folder all uploaded files are in WP-content/blogs. their folder.
- themes and plugins files—you might copy these files or reinstall them in the new site.
Going through the Migration process
Finding the Website ID
Each site in the network is defined by its own unique numerical ID. This identifies its folder in wp-content/uploads/sites (or wp-content/blogs.dir if your Multisite network is older), and also to identify the database tables for that site.
By going to Network Admin > Sites > Edit option for the site you’re working with, you will be redirected to the URL where the last part XX represents the website ID:
Exporting the Site’s Tables From the Network Database
There is no need to move entire database as you are moving a child website only.
In PhpMyAdmin, go to the Export tab. Find the tables relating to the website you are moving (they begin with wp_XX_, where XX is the ID of your site), select and then export them.
All data relating to users of the network are stored in two tables:
Depending on the number of users that you have, you may choose among two options:
- To export those tables as well, import them to the new site and edit users in the admin screens to remove any that are not relevant to the new site.
- To recreate users on the new site.
Editing the Database Tables
Make a copy of the sql file that’s been downloaded to your local drive and open it in a code editor.
Editing Table References
The database tables in your new single website installation won’t have prefixes for the site ID, so you’ll need to remove these. In your sql file, replace all instances of wp_XX_ with wp_ (XX is your site ID).
-- Check siteurl SELECT option_value FROM wp_options WHERE option_name = 'siteurl'
-- Update URL_move_from and URL_move_to inside single quotes UPDATE wp_options SET option_value = replace (option_value, 'URL_move_from', 'URL_move_to') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'URL_move_from','URL_move_to'); UPDATE wp_posts SET post_content = replace(post_content, 'URL_move_from','URL_move_to');
Now you can save the modified SQL file.
Install WordPress on your destination
Uploading Files to the New Site
- Copy files from old wp-content/uploads/sites (or wp-content/blogs.dir) folder to wp-content/uploads. Please note that you may need to delete any folders WordPress has created in your new uploads folder.
- Identify Plugins and Themes used by the old website and re-install them again, or migrate files and folders manually to wp-content/plugins and wp-content/themes.
Importing Tables to the New Database
In phpMyAdmin, drop the following tables from your newly created database:
Don’t delete the wp_usermeta or wp_users tables, unless you’ve chosen to copy these across from the network as well.
Now you can upload the database you’ve edited – Click the Import tab > Choose file button > Select the sql file you’ve edited and click Choose or OK.
Clear the browser cache and log in to the WordPress admin of your new website. f you moved the user tables across, your login details will be the same as for your old site, but if not, these will be whatever you specified during the WordPress installation process.
Visit the Permalinks settings and re-save your settings.
Check that all your links are working fine and that widgets and plugins are behaving as they should. If not, you can either step back through the process, using your backups where you need to, or set up the plugins and widgets again.
Removing the Website From Your Multisite Network
Once you are completely happy that everything is working properly, remove the site from your Multisite network. I recommend leaving this at least a week in case you see anything that hasn’t moved across.
In the meantime, you may configure the old site’s domain to map to the new one.
Congratulations on finishing this long journey!