Multiple Databases, Toggle Between Them With wp-config.php

Curious if this setup is possible in Local: I have 5 different sites, all share the same parent theme (they all get their code from same parent theme repo), and each has a unique child theme. I would like to be able to do this:

  • Use one WordPress install for all five sites
  • Have the parent and all 5 child themes in the wp-content/themes/ directory
  • Toggle between 5 different databases by changing out the define(‘DB_NAME’, ‘my_db_name’); line in wp-config

I’m thinking though that this isn’t really feasible in Local, since it seems to expect one WP install with one database in each container?

Note that I will get around having ‘uploads’ from the sites mixed together by using

Sounds like you want to create a multisite installation.

except a multisite has 1 database with (in this case) 5 different site-specific-table-prefixes and the OP has 5 different databases.
I guess migrating to a multi-site installation would be the best way to do this, but changing a db-prefix is often error-prone.

All these sites are using WooCommerce and need separate databases to keep users and such separate. Ultimately I just wanted to have the parent theme and the plugins in the same local install to make things easier on me so I didnt have to install a plugin on 5 different local installs and other small nuisances. What I ended up doing was creating a new Local install for each site, and then creating a Github repo for the parent theme, a Github repo for each child theme (6 Github repos totals in this example), then creating a parent repo and a child repo locally for each install (10 total repos locally). And then 6 DeployHQ projects to deploy it all to WPEngine: One DeployHQ project to update parent themes on all 5 sites all-at-once, and then one DeployHQ project for each child theme. It works pretty nice.

One thing that also may work is using the Local Volumes add-on to share the same themes between all 5 sites.

You could also use that to share a folder that contains the contents for wp-uploads. Or, you could just share wp-content between all of the sites.

Thanks Clay, I will check that out!