This is something I’ve wanted to write about for quite some time. Part of my building process involves three environments: local, staging and production. Most of the sites I’ve built are straight-forward “single sites” with a few bits of magic here and there. However, with my job, I manage several mutli-site websites.
For information on getting started with a WordPress multi-site, detailed instructions can be found in the WordPress documentation. For this demo, I’m going to assume you’re taking over a multi-site and are needing to make changes locally and there is a main site and two sub-sites. Also, let’s assume your local website will be “http://demo.local”.
Modifying Tables
Once you’ve downloaded the database and imported it to the database you’re planning on using, it’ll be important to look for the following tables: wp_[site-id]_options, wp_blogs, wp_options, wp_site and wp_sitemeta.
wp_[site-id]_options
You will have several of these. These correspond with the Site ID in the Network tab. You will need to change the siteurl and home columns to “http://demo.local”.
wp_blogs
This is a little easier. Change each row in the domain column to “demo.local”.
wp_options
Like the wp_blogs table, this will also need the siteurl_and home_ columns updated to “http://demo.local”.
wp_site
Like the wp_blogs table, each row in the domain column will need to be updated to “demo.local”.
wp_sitemeta
Finally, I’ve only had issues with this once, however there is one last cell that needs to be updated. Look for the siteurl column and update the value to “http://demo.local”.
And that’s it! It’s best to clear the cache on your local machine, but you’ll now be able to log into the WordPress admin panel like you would normally!