Our team has run in to a problem working with WordPress 3 multisite. We usually work with a local copy of the site (localhost/testsite) but with the same database to keep all changes up to date.

This works fine in a single install because you can override the database configs from PHP with:

define( 'URL', $path );  
define( 'WP_HOME', $path );  
define( 'WP_SITEURL', $path );  
define( 'WP_CONTENT_URL', $path . '/wp-content' );  

But this doesn’t work on the multisite because of the extra tables (wp_blogs, wp_site) and they have the path to the blog in their settings.

Does anyone know how to override these settings? I would like the site to run on domain localhost for our developers, developerdomain.com for our test servers and then realdomain.com when the site goes live.

It feels kind of like overkill if we have to set up different databases for each of them and change the domain and path manually and then copy the post, blog and user data between the databases to do debugging and continue the development…

2 Answers
2

Just came up with a solution to this issue posted here https://stackoverflow.com/questions/12958123/override-wp-siteurl-and-wp-home-for-wordpress-multisite/

Basically you do not copy the wp_site and wp_blogs tables to your development installs when pulling in a production database, and have pre-configured them locally for your development URLs. You then leverage a network-wide plugin to set the WP_SITEURL and WP_HOME values based on configuration in wp-config.php.

Will likely turn this into a plugin once I have time to test it further.

Hope that helps!

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *