Streamline migrating to WordPress Multisite with MU-Migration

Migrating a standalone WordPress site to a site network (or “multisite”) environment is a tedious and tricky endeavor.

The WordPress Importer works reasonably well for smaller, simpler sites, but leaves room for improvement. It exports content, but not site configuration data such as Widget and Customizer configurations, plugins, and site settings. The Importer also struggles to handle a large amount of content. Third party backup plugins that are compatible with site networks offer another solution, but they often involve slow intermediary “cloud” backup and restore steps, and the reliable solutions are mostly commercial.

A more “complete” approach involves migrating the raw database and files. Essentially, create the new site in the WordPress network admin, then export the standalone site’s database tables (excluding user data) to a .sql file, modify the table prefixes to include the new site’s network ID (ex: wp_ becomes wp_5_), and import the updated .sql script into the site network. Moving user accounts is even more involved, as they are shared across a site network: the standalone site’s user IDs are likely already assigned, and some users may already exist. Manually recreating accounts is often the easiest path, and one is still left to remap all of the user IDs associated with the imported content. We haven’t even touched on moving and updating uploaded media… Now imagine you need to move several sites into a network!

A recent client project where I consolidated five sites into a site network was a tipping point. I developed a smoother way to move single WordPress sites into a ”multisite” network: MU-Migration.

To use MU-Migration:

  1. First, make sure you have WP-CLI up and running on the server.
  2. Install MU-Migration (using WP-CLI 0.23 or newer) by running:
    $ wp package install 10up/mu-migration
  3. Run this command on all sites to be moved:
    $ wp mu-migration export all --themes --plugins --uploads
    Note: The flags --themes, --plugins, and --uploads are optional and, when used, will include the themes, plugins, and uploads folders in the .ZIP package respectively.
  4. Move .ZIP file(s) to your multisite server
  5. Run the following command on your multisite instance:
    $ wp mu-migration import all [--new_url=]
    Note: The --new_url param is optional and changes the siteurl via a search-and-replace.
  6. Once the import finishes, flush the site cache (e.g. Memcached, Redis, Varnish).
  7. Enjoy!

10up has open sourced MU-Migration on Github. We welcome your suggestions, bug reports, and pull requests.

  1. Hi Nicolas,
    I am getting: Warning: ‘Unable to create the zip file’ on Windows 10. Any idea how to resolve this?

    • This plugin does not officially support Windows as it requires some dependencies that Windows does not have by default. However, I’m not sure why you’re getting this error specifically. Feel free to open a issue on our Github:

  2. hi, is it possible to use this for migrating multi > single ?

    • Hi Delonge, not currently. The import commands assumes that the user is running a multisite instance. I do have plans to add such functionality as it’s already possible to export a single site from Multisite. Feel free to open a issue on Github ( suggesting this or even submit a PR :).

  3. I’m getting a ‘Something went wrong while trying to export the database’ error. Wonder how I can overcome that. The local MAMP site is otherwise behaving fine. And if I use the regular wp db export, it works fine. Any help I will highly appreciate.

  4. I cannot install the mu migration package.

    In a terminal window on Ubuntu 16.04.4 running
    wp package install 10up/mu-migration

    I get
    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16777224 bytes) in phar:///usr/local/bin/wp/vendor/composer/composer/src/Composer/DependencyResolver/RuleSet.php on line 83

    I added memory_limit = 512M to my user.ini but no luck

Leave a Comment

Finely crafted websites & tools that make the web better.