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

Subscribe to our newsletter to get the latest Roots updates, along with occasional tips on building better WordPress sites.

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

Follow @rootswp on Twitter