These are my notes relating to migrating a multisite site to a stand alone WordPress install.
I tried various options in the past, including manual file extract and database manipulation, through to using Duplicator Pro, none were easy or totally successful and often I’d resort to completely rebuilding the site and exporting / importing the data.
However I think I now have a good solution using WP CLI and https://github.com/10up/MU-Migration
I would recommend migrating first to a localhost instance, primarily so you can check, but also if you are using domain mapping on multisite you will want minimal downtime, and if your accounts are on the same host’s shared IP you wont be able to create an account with the same domain in parallel anyway.
1. your multi site host has WP CLI installed
2. you have SSH access
3. you have a local dev environment, for this I’ll assume Docker instance with WP CLI installed
Extract the site
Install 10-up/MU-Migration on you multisite host
php -d memory_limit=512M "$(which wp)" package install 10up/mu-migration
I found the memory limit increase was needed
Then find your blog id
wp site list
Then simply run this command to create a zip file ( assume blog_id = 123 – change it as required )
wp mu-migration export all ../mysite.zip --themes --plugins --uploads --blog_id=123
Create a localhost environment
Build an empty WordPress site, in Docker is may look a bit like the following
docker exec --user 1000:33 -i mysite123_php_1 php -d memory_limit=512M "$(which wp)" package install 10up/mu-migration docker exec --user 1000:33 -i mysite123_php_1 wp core download docker exec --user 1000:33 -i mysite123_php_1 wp core config --dbhost=db --dbname=wp --dbuser=wordpress --dbpass=wordpress docker exec --user 1000:33 -i mysite123_php_1 wp db reset --yes docker exec --user 1000:33 -i mysite123_php_1 wp core install --url="http://localhost:8123" --title="mysite" --admin_user="myuser" --admin_password="mypass" --admin_email="firstname.lastname@example.org" d
Then grab the zip file from the multi-site host into a temp directory ( e.g. zip ) inside you docker files system e.g.
scp email@example.com:~/mysite.zip zip/mysite.zip
Extract the site into Localhost
Then simply run the extract
docker exec --user 1000:33 -i mysite123_php_1 wp mu-migration import all zip/mysite.zip --new_url='http://localhost:8123'
Now check you localhost:8123 it may look good, but if images are missing it is likely you are on an older multisite and the paths to images didn’t get converted. Have a look in ‘media’ at the urls and work out what is wrong You can use wp search replace e.g.
docker exec --user 1000:33 -i mysite123_php_1 wp search-replace blogs.dir/123/files uploads
Deploy to live
Once you are happy, you can deploy to live.
Turn off the domain mapping on multisite and remove the domain / domain alias from the host.
Create a new hosting account for the single site
Migrate your localhost to live using your preferred method. Of course I use WP CLI and rsync, but that is up to you.[Next] Find out where to host WordPress [Read the full article…]