2

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...

1
  • I came up with a pretty simple solution that continues to maintain things in wp-config.php: stackoverflow.com/a/16327059/76672 No plugins, might not be for everyone...
    – Jake
    May 1, 2013 at 21:49

2 Answers 2

1

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!

0

This problem has been rectified in recent versions of WordPress. However, the easiest solution to this is to make the file paths on the servers match, e.g. put all source in /var/www/ on each server. Nice and easy :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.