Is there a straightforward way to share/sync multiple WP instances with a single database? I work collaboratively with several developers on custom themed sites. We use git to keep our files in order and it's all fine in the early stages, but once content, plugins etc. start coming into play, we have issues with staying in sync with content.

Is there a decent solution over than tossing the SQL file around? That gets old pretty fast and doesn't work very well.

2 Answers 2


Yes. Use WP_HOME and WP_SITEURL in your wp-config.php, so the URLs in the database won't mess (a lot) with local site development.

define ('WP_HOME', 'http://local/site/url');
define ('WP_SITEURL', 'http://local/site/url');

Also, some other good practices:

  • Put in your .gitignore things like:

    wp-content ... # Everything that is created by users
  • Make a copy of the wp-config.php file and use it as a template, name it something like wp-config.php.<your branch name>, add it to the version tree and fill it with the basic development configuration, so developers can just keep their wp-config.php untouched by Git, but can also apply new configuration sets that may be required by other functionality.

  • You can also create a wp-config.php.<branch> for each environment the site runs (development, homologation, production).

  • Create a remote uploads repository in the development server, and mount it as a local directory, so an upload to the site that creates a new entry in wp_posts will also sync the file with other developers. Leave the mount information in a README or even in the wp-config.php.<branch> file. You can use a Samba share or even a SSHFS command line like:

    sshfs user@server:/path/project-uploads wp-content/uploads
  • 1
    For any PHP script, and especially for configuration files, it is highly dangerous to rename the file to something.php.<anything>. There is a great chance that the wp-config.php<branch> will be either shown as plain text or downloaded as an attachement. Then, any sensitive information in it will be compromise. Try wp-config.<branch>.php instead.
    – asiby
    Jan 19, 2021 at 4:27

No there isn't.

Sure you can all connect to the same DB, I prefer a technique like this http://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/ ,but syncing actual content and unique ID's/values stored in the database is a problem. You can hack a script that cleans everything up but it's often easier to just have one person/machine doing actual content changes.

It's easier to just dump the database each day or export the content using WordPress's native exporter and commit it as well. Also using a CDN for images helps.

Your Answer

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

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