roots/wp-stage-switcher

WordPress plugin that allows you to switch between different environments from the admin bar

Fund package maintenance!
roots

Installs: 328 180

Dependents: 2

Suggesters: 0

Security: 0

Stars: 367

Watchers: 28

Forks: 42

Open Issues: 3

Type:wordpress-plugin

2.2.0 2022-05-31 19:37 UTC

This package is auto-updated.

Last update: 2024-11-17 22:16:03 UTC


README

Packagist Packagist Downloads

A WordPress plugin that allows you to switch between different environments from the admin bar.

WordPress Stage Switcher

Requirements

You'll need to have ENVIRONMENTS and WP_ENV defined in your WordPress config.

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

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

Note: the serialize() call is not needed on PHP 7.0 or newer.

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.

Installation

This plugin must be installed via Composer. Add wp-stage-switcher to your project's dependencies:

composer require roots/wp-stage-switcher

Or manually add it to your composer.json:

"require": {
  "php": ">=7.1",
  "roots/wordpress": "5.1.1",
  "roots/wp-stage-switcher": "~2.1"
}

Support

Use the Roots Discourse to ask questions and get support.