Given a WordPress Multisite network, with a main blog, and assuming all content has been moved on to that blog, how would one collapse the network back down into a standard WordPress non-network non-multisite install?
Leave a Reply
You must be logged in to post a comment.
I’ve gone through the steps to extract a site from a multisite install to a single instance now:
DELETE FROM wp_usermeta WHERE user_id NOT IN( SELECT distinct(user_id) FROM wp_usermeta where meta_key LIKE 'wp_SITEID_%' );
DELETE FROM wp_users WHERE ID NOT IN( SELECT distinct(user_id) FROM wp_usermeta where meta_key LIKE 'wp_SITEID_%' );
UPDATE wp_usermeta SET meta_key = REPLACE( meta_key, 'wp_SITEID_', 'wp_' ) WHERE meta_key LIKE 'wp_SITEID_%';
UPDATE wp_options SET option_name = REPLACE( option_name, 'wp_SITEID_', 'wp_' ) WHERE option_name LIKE 'wp_SITEID_%';
wp-config.php
but don’t click ‘Run the install’blogs.dir/SITE_ID/files
withuploads
, and if you’re changing your site URL search foroldsite.com
and replace withnewsite.com
.A fair bit of effort and you have to be careful with the database edits but that’s the only I can see to extract a single site from an existing multisite with all its settings etc… intact.
EDIT:
As spotted by @Jake I forgot to mention the final steps you may need to take eg. search/replace of old URLs. I’ve updated the list accordingly.
It is possible to remove the multisite install without reinstall a new blog. Follow steps.
WP_ALLOW_MULTISITE
in your wp-config.php toFALSE
Remove or comment MU settings in
wp-config.php
, like this:Remove the MU settings from
.htaccess
, like the source below:Create the permalinks new, in the backend
wp-admin/options-permalink.php
and maybe copy the result in.htaccess
, if is not possible for WP, rights for write on this file.Remove un-usefull entries in table
users
; use the follow sql statement in a tool, like phpMyAdmin or AdminerThe follow tables can be dropped:
(change
wp_
to your database prefix)Now you have only the last tables of other blogs of the network. If you will use it also this content, then export this before via WordPress export as XML and import now in the clean single install.
Actually it is possible and fairly easy to do; I’ve done it myself several times.
There are there things to consider.
Commenting out the multi site define(?) in wp-config and updating your permalinks will revert the site to single site/default mode. Then all you have to do is clean up your database.
If for some reason you are not able to access your wp-admin to update the permalinks simply delete your .htaccess file. WordPress will recreate it for you in single site mode.
I’ll do my best to find the link to the codes/support article and update the answer with it.
Here’s a link to one item on the support forum http://wordpress.org/support/topic/revert-to-single-site
The basic processes here work well even in WP 3.5.1
One clarification: If you named your subsite something you’ll have to change the links in the database to remove that name. If my subsite was named… mysite.com/comics then after following the above procedures your WP will look for mysite.com/comics and get errors on the permalinks. Edit the WP-OPTIONS table looking for the /comics extension and remove it. Also, check that the Uploads directory is pointing to the proper location – it may still show a blogs.dir entry and should now instead point to wp-content/uploads/
The very important point that shouldn’t be missed, and it’s less talked about, is that you should still do have the line:
define( 'WP_ALLOW_MULTISITE',
…But it should be changed updated to
define( 'WP_ALLOW_MULTISITE', 0 );