How to disable WordPress multisite

How to disable WordPress multisite

I recently moved my personal blog from a WordPress multisite to the Ghost CMS. That means, I have no need for a multisite, so this post will explain how I returned my WordPress install to a standard one.

The easy way

If you didn’t change your primary site, all you need to do is remove the multisite-related settings from the wp-config.php file, after deleting all the sites except the main one. Those directives look something like this:

define( 'WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', '');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Then, you’ll need to revert the .htaccess rules back to the default, but if you’re not using Apache, you can skip this step.

The hard way

If you’re like me and changed the primary site for some reason, you’ll need a few extra steps. First, delete all the sites you can, and remove the rules from wp-config.php. Then, you’ll need to change the database prefix, something like:

$table_prefix  = 'wp_';

to whatever the site id was:

$table_prefix = 'wp_2_';

Now, you’ll realize that your site won’t let you log in. That’s because of the user tables, so run the following commands in a root MySQL shell:

USE wordpress_DB;
RENAME TABLE wp_users TO wp_4_users;
RENAME TABLE wp_usermeta TO wp_4_usermeta;

and you should now be able to log in! But, if you’re like me and need the database prefix to be just wp_ without the site id, you’ll need to also run the following (bash) commands:

sudo mysqldump wordpress_DB > orig.sql
sudo cp origi.sql mod.sql
sudo mysql -e "DROP DATABASE wordpress_DB"
sudo sed -i "s/wp_4_/wp_/g" mod.sql
sudo mysql -e "CREATE DATABASE wordpress_DB"
sudo mysql wordpress_DB < mod.sql

and, with a bit of luck, you should be able to change your table prefix back to:

$table_prefix = 'wp_';

and be able to log in!


All your settings should still be stored, and plugins, while they may be deactivated, should retain all of their settings. However, whenever modifying anything as big as the DB in WordPress, be sure to have a backup in case you break something.

Leave a Reply(Markdown is On)

%d bloggers like this: