PHPackages                             alleyinteractive/wp-environment-switcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alleyinteractive/wp-environment-switcher

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

alleyinteractive/wp-environment-switcher
========================================

Easily switch between different site environments from the WordPress admin bar.

v1.2.1(1y ago)4222.0k↓15.4%[3 PRs](https://github.com/alleyinteractive/wp-environment-switcher/pulls)GPL-2.0-or-laterPHPPHP ^8.1CI passing

Since Jul 6Pushed 2mo ago17 watchersCompare

[ Source](https://github.com/alleyinteractive/wp-environment-switcher)[ Packagist](https://packagist.org/packages/alleyinteractive/wp-environment-switcher)[ Docs](https://github.com/alleyinteractive/wp-environment-switcher)[ RSS](/packages/alleyinteractive-wp-environment-switcher/feed)WikiDiscussions develop Synced 2w ago

READMEChangelog (5)Dependencies (2)Versions (13)Used By (0)

WordPress Environment Switcher
==============================

[](#wordpress-environment-switcher)

[![Playwright Tests](https://github.com/alleyinteractive/wp-environment-switcher/actions/workflows/playwright.yml/badge.svg)](https://github.com/alleyinteractive/wp-environment-switcher/actions/workflows/playwright.yml)

Easily switch between different site environments from the WordPress admin bar.

> Props to [WordPress Stage Switcher](https://github.com/roots/wp-stage-switcher) for the inspiration.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require alleyinteractive/wp-environment-switcher
```

Usage
-----

[](#usage)

Activate the plugin in WordPress and you will see the switcher appear in the top right admin bar:

[![Screenshot of plugin](https://private-user-images.githubusercontent.com/346399/251573786-83684c99-4f74-4969-b302-a0c617c17190.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50L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czMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDgwMVQwMTIxNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zYWY0YTdjZGMwZTNkYTdmZmQ2NGVkNWMwNzQ2NDE4N2I4ZmZiNzQ1MmI1MzE0MmFhZDAyZTk5YThjMzVlM2QyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.o6wFR4C-8ygyej7-s3tbeaJGp6s2bF1k1SsdQGL99iY)

The plugin reads the current WordPress environment from the current hosting provider (Pantheon and WordPress VIP supported) and falls back to `wp_get_environment_type()` which can be set by defining `WP_ENVIRONMENT_TYPE`in your `wp-config.php` file. You can override the current environment by using the `wp_environment_switcher_current_environment` filter:

```
add_filter(
	'wp_environment_switcher_current_environment',
	fn () => 'my-custom-environment'
);
```

You can define the available environments by using the `wp_environment_switcher_environments` filter:

```
add_filter(
	'wp_environment_switcher_environments',
	fn () => [
		'production' => 'https://example.org',
		'staging'    => 'https://staging.example.org',
		'local'      => 'https://example.test',
	]
);
```

The environments can also be defined as an array of associative arrays, which allows for more flexibility:

```
add_filter(
	'wp_environment_switcher_environments',
	fn () => [
		[
			'type'  => 'production',
			'url'   => 'https://example.org',
			'label' => 'Production Site',
		],
		[
			'type'  => 'staging',
			'url'   => 'https://staging.example.org',
			'label' => 'Staging Site',
		],
		[
			'type'  => 'local',
			'url'   => 'https://example.test',
			'label' => 'Local Development',
		],
	]
);
```

The `type`, `url`, and `label` keys are required for each environment.

The plugin will automatically detect the current environment and highlight it in the switcher. By default, the plugin will show the switcher to anybody with the `manage_options` capability. You can change this by modifying the capability mapped to the `view_environment_switcher` capability with `map_meta_cap`.

Testing
-------

[](#testing)

Run `composer test` to run tests against PHPStan/PHPCS.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

This project is actively maintained by [Alley Interactive](https://github.com/alleyinteractive). Like what you see? [Come work with us](https://alley.com/careers/).

- [Sean Fisher](https://github.com/srtfisher)
- [All Contributors](../../contributors)

License
-------

[](#license)

The GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance68

Regular maintenance activity

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~186 days

Total

5

Last Release

389d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/338d27065b1074f2d66d049d742f22996dd137eef6f91bc8f75350ceee1e8ef2?d=identicon)[srtfisher](/maintainers/srtfisher)

---

Top Contributors

[![srtfisher](https://avatars.githubusercontent.com/u/346399?v=4)](https://github.com/srtfisher "srtfisher (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")[![nlemoine](https://avatars.githubusercontent.com/u/2526939?v=4)](https://github.com/nlemoine "nlemoine (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")

---

Tags

wordpresswordpress-pluginalleyinteractivewp-environment-switcher

### Embed Badge

![Health badge](/badges/alleyinteractive-wp-environment-switcher/health.svg)

```
[![Health](https://phpackages.com/badges/alleyinteractive-wp-environment-switcher/health.svg)](https://phpackages.com/packages/alleyinteractive-wp-environment-switcher)
```

###  Alternatives

[alleyinteractive/wp-block-converter

Convert HTML into Gutenberg Blocks with PHP

68460.5k2](/packages/alleyinteractive-wp-block-converter)[alleyinteractive/wp-curate

Plugin to curate homepages and other landing pages

11268.5k](/packages/alleyinteractive-wp-curate)[alleyinteractive/feed-consumer

Ingest external feeds and other data sources into WordPress

117.1k](/packages/alleyinteractive-feed-consumer)[tatter/settings

Lightweight settings management for CodeIgniter 4

2210.1k3](/packages/tatter-settings)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
