WordPress Multisite allows you to host multiple websites with a shared collection of users and plugins. You might need to remove one of the sites for various reasons. If you end up with only one site active, it would be nice to revert to a single site install. These instructions below follow what I’ve used recently to revert a multisite to a single install.
Preparing to go back to a single site
There are some steps you can take, even while your website is still live, to prepare for the switch. These should be done first while the WordPress dashboard is still accessible.
- Backup all involved websites.
- Remove any additional websites from the multisite.
- Remove users that only exist on a separate website.
- Ensure all network “super admins” are also regular administrators on the remaining site.
- Disable all Network Activated plugins, and activate them on the single site dashboard.
- Be sure to copy settings from network activate plugins to the single site settings.
- Note that network-activate plugins will not be active when you remove multisite functionality.
- Advanced users can move the settings from wp_sitemeta to wp_options, for most plugins.
- Remove any multisite-exclusive plugins.
- Copy any Network settings to your single site settings, like the admin email, as needed.
- If you have a custom theme or any custom plugins, review the code to ensure it works without multisite functions like
switch_to_blog
. In this case you could add a conditional statement like so:if ( function_exists( 'switch_to_blog' ) ) {
switch_to_blog( 1 );
}
Removing multisite: Performing the switch
Now that your website can stand on its own and no longer relies on plugins or settings from the multisite network, it’s time to turn off multisite. Be sure you have FTP or direct file access. It is possible that when disabling multisite, something goes wrong and you need to turn it back on temporarily.
We’re effectively reversing the steps from Create a Network (wordpress.org). Be sure to review that page to see if there is any new information about setting up a multisite network which may not be referenced here.
1. Remove multisite settings from wp-config.php.
Go to your multisite and get the new single site’s network site ID. If your single site’s network ID is not 1, WordPress would have changed the site prefix so your posts would be stored in wp_2_posts instead of just wp_posts.
If that is the case, you’ll want to edit wp-config and change $table_prefix to “wp_2_”. Or change all of the table names, but this is more difficult.
While you’re in the wp-config, you also need to disable some multisite options. Common multisite options are defined below:
define( 'WP_ALLOW_MULTISITE', true ); define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', false ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); define( 'SUNRISE', 'on' );
You’ll want to comment these settings out. If you find you need to revert back to a multisite for any reason, just put this code back in.
If you do not see all of these options, don’t worry about them. You do not need to add any of these settings in, just comment them out if they were already there.
2. Review your .htaccess file
You probably don’t need to edit your .htaccess file unless you moved your wp-admin install directory to a subfolder when installing the multisite network. Out of the box, a multisite’s .htaccess settings should be compatible with single site as well.
Review your .htaccess settings. If you had any multisite specific customizations in there, you may need to remove them.
If you did move the wp-admin to a subfolder, you may need to remove the subfolder references like: ([_0-9a-zA-Z-]+/)?
3. Confirm the single site is functional
After saving and uploading your modified wp-config file, check to see if your website is accessible as a single site install. Keep in mind that you should no longer access /wp-admin/network/.
If you receive any errors, re-add the multisite settings from wp-config.php, then correct the errors.
4. Thoroughly review the website
It’s good news if the front page loads up properly. Be sure to test the entire website to be sure everything works as expected. One particular thing to look out for is if you forgot to copy any network settings for a plugin, that plugin might be using default settings.
Cleaning up your database
Now that your website is on a single install again, you can remove any network specific settings from the database including:
- wp_site
- wp_sitemeta
- wp_blogs
- wp_blogmeta
- wp_blog_versions
- wp_domain_mapping
- wp_domain_mapping_logins
Leave a Reply