Switch Between Environments from the WordPress Admin Bar

We've released a WordPress Stage Switcher plugin that will allow you to easily switch between environments from the WordPress admin bar:

You'll need to have ENVIRONMENTS and WP_ENV defined in your WordPress config to use the stage switcher.

The ENVIRONMENTS constant must be a serialized array of 'environment' => 'url' elements:

$envs = array(
  'development' => 'http://example.dev',
  'staging'     => 'http://staging.example.com',
  'production'  => 'http://example.com'
);
define('ENVIRONMENTS', serialize($envs));

WP_ENV must be defined as the current environment:

define('WP_ENV', 'development');

If you use Bedrock, WP_ENV is already defined in the config.

View on GitHub

Get our latest updates & occasional tips on building better WordPress sites

Follow @rootswp on Twitter