We where asked to host a site. But then it turned out that site was part of a bigger multisite. So after I got all files & db of the complete site I needed to clean it up and only keep the requested site left.
The quick and dirty steps:
- Don’t change the DNS until you’re done testing.
- Import all files on the server
- Import the database and change the db settings in
- Locally add the domain to the hosts file So I didn’t need to change urls
- delete all sites using
wp site delete SITE_ID
- Only keep site 1 (the primary you can’t delete) and site 12 (the site ID I needed)
Rename the tables
- Rename the site 1 tables in mysql
RENAME TABLE `amsterda_db`.`wp_links` TO `amsterda_db`.`wp_BACKUP_links`;
- Rename the site 12 tables to the normal tables
RENAME TABLE `amsterda_db`.`wp_12_links` TO `amsterda_db`.`wp_links`;
- Make sure you only rename the site tables, don’t rename
wp_blogsand other multisite tables
Update the url
wp_blogsdelete the record of site 12 and change the name to the new main site in
wp_blogs.domain. And rename the url inside
- Also cleanup the
wp-config.phpchange the constant
- Search the database for all mentions of the old mainsite. This is a per case check what should be done.
Links in posts are probably fine. The old url in the
Permissions and roles
- In the
wp_optionstable search for
option_name. If this record is not present. Search it in the
wp_BACKUP_optionsand create the record manually.
- Permissions are still set for site 12 fix that using
wp search-replace wp_12_ wp_ wp_usermeta
- Test your site. At least test uploads, permalinks, creating/updating pages
- The normal steps usually when deploying a new site.
- Think about things that might differ on this inherent setup.
- switch DNS
After the first week
- Delete all
- Check for unneeded plugins
- Check for unneeded users.
- Possible you should cleanup the uploads folder of old sites, although there may be links to those uploads.
Of course it would be even better to remove the multisite setup. But I was out of time. And I still would have done these steps first.