We had 2 large sites on the same WordPress multisite, but then we decided to split it up for the following reasons:
- From a sysadmin point of view, its always better to keep large sites in their own account
- Easier from a debugging point of view – the simpler the setup, the easier it is to find issues
- A lot of plugins (eg Broken link checker) don’t work with multisites. Also its our experience that with many other plugins (eg caching) the experience is less than optimal compared to if they were on their own installation.
So…we decided to take a WP multisite with 2 sites (www.default.org – the default site, and www.addon.org which was added as a multisite subomain addon.default.org and then mapped to www.addon.org using the Domain Mapping plugin)
Extracting the database for the addon site:
- Save a copy of your db somewhere, because we will first extract the db for www.addon.org, before returning to the original db to extract default.org. To extract the db for addon.org, we edited the table using phpmyadmin.
- Empty any tables that can be reindexed (eg for the relevansii or broken links plugins)
- Remove all wp_ tables (these store the data for www.default.org) that have a matching wp_2_ table (these store the data for www.addon.org) Be very careful here, as a few tables eg wp_users and wp_usermeta need to be kept that were shared by both installations – so these have no wp_2_ equivalent.
- Then you can rename all wp_2_ tables to wp_ – for each table, select ‘Structure’ and then ‘Operations’ (maybe there is a faster way to do this via script, but this took me only 20 mins)
- Edit wp-config.php and comment out the multisite variables and the sunrise variable associated with the Domain Mapping plugin
- In wp-content folder, remove the sunrise.php file. Also it is probably a good idea to remove any cache files in this directory and temporarily get rid of any caching plugins.
- In our newly renamed wp_options table change the site_name and home variables from addon.default.org to www.addon.org, and change the upload_path variable from wp-content/blogs.dir/2/files to wp-content/uploads
- Now we need to do some find and replace in our newly renamed wp_posts table: we need to change all instances of wp-content/blogs.dir/2/files to wp-content/uploads and also all instances of addon.default.org to www.addon.org. So in the SQL tab you can do the following commands:
update wp_posts set post_content = replace(post_content,’wp-content/blogs.dir/2/files’,’wp-content/uploads’);
update wp_posts set post_content = replace(post_content,’addon.default.org’,’www.addon.org’);
It is no harm to also change the guid entry, just for the sake of cleanliness:
update wp_posts set guid = replace(guid,’wp-content/blogs.dir/2/files’,’wp-content/uploads’);
update wp_posts set guid = replace(guid,’addon.default.org’,’www.addon.org’);
You might also need to do search and replace in any other database tables added by other plugins eg the redirection module.
- Finally, delete the uploads folder (again, make sure it is backed up somewhere) and rename the wp-content/blogs.dir/2/files folder to wp-content/uploads