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.test',
  '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

Help support our open-source development efforts

Help us grow

Join over 7,800+ subscribers on 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?

“Easily the best WordPress email I get.” Colin OBrien

Follow us on Twitter @rootswp

Ready to checkout?