Multiple Development Sites

How to Have Many WordPress Development Sites with Only One Install


  1. Many web hosts. One host for each customer development site.
  2. Multiple databases. One for each site.
  3. Multiple upload directories. One for each site.
  4. Only one WordPress installation.
  5. Only one plugins and theme directory.
  6. One PHP installation. Different PHP versions can be used for each web site.

Create a virtual web host for each site.

<VirtualHost *:80>
    ServerName ""
    Redirect "/" ""

<VirtualHost *:443>
    ServerName ""
    ServerAdmin ""
    CustomLog "C:/customers/acme-cannons/wordpress-develop/logs/access_%Y-%m-%d.log" common
    ErrorLog "C:/customers/acme-cannons/wordpress-develop/logs/error.log"

    # WordPress
    DocumentRoot "C:/customers/acme-cannons/wordpress-develop/src"
    <Directory "C:/customers/acme-cannons/wordpress-develop/src">
        Require all granted
        AllowOverride FileInfo
        Options +ExecCGI
        Options -MultiViews

        # php FastCGI
        FcgidWrapper "${PHP80}/php-cgi-wordpress.exe -c ${PHP80}/php-wordpress.ini -d error_log=\"C:/customers/acme-cannons/wordpress-develop/logs/php_errors.log\"" .php

    Alias "/wp-content/uploads" "C:/customers/acme-cannons/wordpress-develop/uploads"
    <Directory "C:/customers/acme-cannons/wordpress-develop/uploads">
        Require all granted


Install WordPress.

git clone C:/wordpress-develop

Checkout and build a WordPress version.

cd c:/wordpress-develop
git checkout --no-track -b Branch_5.9.0 5.9.0 --

composer install
npm install
npm run build:dev

Add and commit the un-versioned assets that were just built from these directories.

  1. src/wp-admin/css
  2. src/wp-admin/js
  3. src/wp-includes/blocks
  4. src/wp-includes/css
  5. src/wp-includes/js

There is no need to add the node_modules or vendor directories.

Now it is easy to switch between different versions of WordPress.

Create a directory that contains:

  1. a symlink to the WordPress src directory
    mklink /D src C:\wordpress-develop\src
  2. an uploads directory

Create a src/wp-config.php file that:

  1. loads the appropriate config file from wordpress-develop based on getcwd() or exits with an error message
    1. The config file should define where the WordPress debug log is.
      define( 'WP_DEBUG_LOG', 'C:/customers/acme-cannons/wordpress-develop/logs/wp_debug.log' );
    2. require_once( ABSPATH . 'wp-settings.php' );
$virtual_hosts = array(
	'acme-cannons' => 'C:/customers/acme-cannons/wordpress/',
	'acme-rockets' => 'C:/customers/acme-rockets/wordpress/',

$current_working_directory = str_replace( '\\', '/', getcwd() );

$found = false;
foreach ( $virtual_hosts as $virtual_host => $directory ) {
	if ( strpos( $current_working_directory, $directory ) === 0 ) {
		require_once dirname( ABSPATH ) . DIRECTORY_SEPARATOR . "wp-config-$virtual_host.php";
		$found = true;

if ( false === $found ) {
	exit( "Host directory not found for $current_working_directory." );

require_once( ABSPATH . 'wp-settings.php' );

define( 'WP_ENVIRONMENT_TYPE', 'development' );
/* That's all, stop editing! Happy publishing. */


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.