Transferring a single WordPress site to a multisite WordPress system can become complicated, especially if you have a large website with many contents and plugins. Here we will see how we can manually transfer a single site using the WP command-line interface. In this document, we assume you have access to the servers hosting your websites and have created a multisite WordPress network, and you are ready to transfer your site.
Backup your files and your database:
When you create a new site in multisite WordPress, a corresponding folder for that is created. Assume the WordPress picks up the id 8 for this site; thus its contents are stored in:
/path/to/multisite-root/wp-content/uploads/sites/8
Copy all uploaded contents to the new location:
Before you proceed, you have to install and activate all used plugins and themes in the multisite WordPress. To get the list of installed plugins in the single-site WordPress:
Plugins settings and configuration you have made are all stored in the wp-options table. In a multisite environment, each site has its own set of tables. They are distinguished by getting a unique prefix. For instance, wp-options for our target site is became wp-8-options. We first export this table from single-site WordPress:
Now we have two files which we have to perform some filtering on them. In particular, we need to change the path to the contents and the site URL and home URL.
Open the ~/wordpress_options.sql
and change the site URL and home URL to multisite URL in the first line of INSERT TO statement.
Once you finish that, it is time to change some paths on the XML file which contains the contents of your site:
By now, we are almost done. We need to import the ~/wordpress_options.sql
and <xml-file>
into the database.
Check the output of the above commands for any failure during the import procedure. If you get some error, look for the corresponding attachments in the <xml-file>
. You probably need to correct the paths of a few items. The file usermaps.csv
provides a mapping from contents’ authors and the current existing users in the multisite WordPress. It looks like:
Often times, you will see some images or links which still are using the <old-url>
. To check the whole database for any occurances:
Although this is a useful tool, however, you can also dump the whole database and replace whatever is needed as well.