Migrating WordPress multisite to single site

Moving a WordPress website out of a multisite network and into a single installation can be tricky. One way to do it is to rebuild your website from scratch, including exporting/importing the content. However, depending on the website, it may be quicker to transfer the website at a file and database level. If you’re comfortable working with databases, editing files and using FTP, consider the following approach to migrating WordPress from multisite to single site.

Install WordPress on new site

1. Install a new, single site version of WordPress, including creating an admin account. This is important because, since users are managed by multisite in a much different way, the roles will not transfer and you won’t be able to log in using a migrated role initially. Later you can reassign roles as necessary (see below).

Export database of old site

2. Open the database of the multisite in phpMyAdmin and locate the tables with a prefix that corresponds to the site ID being migrated, e.g., “wp_3_”.

3. Check all of the corresponding tables and select Export from the dropdown menu towards the bottom (selecting Export from the top menu will export the entire database).

Edit SQL file before import

4. Using a text editor (Notepad++ works well), perform the following find and replace events:

a. Replace all instances of the old table prefix with the new. For example, replace “wp_3_” with “wp_”.

b. Replace the uploads path, excluding the domain and trailing slash, because multisite uses a different file structure than single site. For example, replace “uploads/sites/3” with “uploads”.

c. Replace all instances of the multisite domain and directory URL, including the trailing slash and “http://” (and/or “https://”). For example, replace “http://www.your-multisite-domain.com/directory-name/” with just a “/”. (If the multisite was set up with subdomains instead of directories, replace “http://subdomain.your-multisite-domain.com/”.)

You might also need to replace the same string minus the trailing slash or minus the “www”. For example, search for “http://www.your-multisite-domain.com/directory-name“, “http://your-multisite-domain.com/directory-name/” and “http://your-multisite-domain.com/directory-name“.

d. Finally, replace any instances of the multisite domain without the directory. For example, replace “http://www.your-multisite-domain.com/” with “/” and then “http://www.your-multisite-domain.com” with “/”.

e. Be careful with what order you replace these strings in. If you have a page with the URL, “http://www.your-domain.com/sample-page/” and you do the replace without the trailing slash first, you could end up with “//sample-page” instead of “/sample-page”.

Import the SQL file

5. Import the SQL file. You can do this in phpMyAdmin or your hosting provider may have an import tool available in your administrative dashboard.

Download website files

6. Via FTP, download the plugin files from the multisite “wp-content/plugins/” directory. Do the same for the themes (“wp-content/themes/”) and uploads files (for example, “uploads/sites/3”).

Edit theme files

7. Depending on your themes, you may need to run the same string replacements from step 4 on your theme files.

Upload website files

8. Via FTP, upload the plugin files to the new single install under “wp-content/plugins/”. Do the same for the themes and uploads files (to “wp-content/themes/” and “wp-content/uploads/”).

Reassign roles to users

9. Log into the admin dashboard to edit each user and reassign applicable roles (Administrator, Editor, Author, etc.). Also check your general settings and plugin settings.

That’s it! Try it out and let me know how it goes in the comments below.

4 responses to “Migrating WordPress multisite to single site

Comments are closed.