Search by

kitaris / environment-indicator

dannorthern

Shows which environment a WordPress site is running as (local, development, staging or production) in the admin bar.

Package info

github.com/builtnorth/kitaris-environment-indicator

Type:wordpress-plugin

pkg:composer/kitaris/environment-indicator

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.4 2026-10-25 04:16 UTC

This package is auto-updated.

Last update: 2026-10-25 04:17:50 UTC


README

=== Kitaris Environment Indicator ===
Contributors: kitaris, dannorthern
Tags: environment, staging, development, admin bar, indicator
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

See at a glance whether you are on local, development, staging or production, right in the admin bar.

== Description ==

Kitaris Environment Indicator adds a small colored badge to the admin bar showing which environment the site is running as. No more editing production when you meant to edit staging.

* Reads the environment WordPress already knows about (`WP_ENVIRONMENT_TYPE`), so there is nothing to configure.
* A distinct color for each environment: local, development, staging and production.
* Change any label or dot color under Settings → Environment Indicator, or set them in code.
* Need an environment WordPress has no type for, like QA or Client Review? Give it a custom name.
* Shown to anyone who can edit content (contributors and up) by default.
* Works on phones too: the badge shows as a colored dot, and tapping it shows the label.
* Lightweight: no front-end assets for visitors, no database tables, one option.

= Set the environment =

Add this to `wp-config.php` (or set the `WP_ENVIRONMENT_TYPE` environment variable):

`define( 'WP_ENVIRONMENT_TYPE', 'staging' );`

Accepted values are `local`, `development`, `staging` and `production`. WordPress treats a site with no setting as `production`.

= Custom environments =

WordPress itself only knows the four types above, and treats any other value as `production`. To show another name, keep `WP_ENVIRONMENT_TYPE` set to the type WordPress should behave as, and add a custom name:

`define( 'KITARIS_ENVIRONMENT_INDICATOR_CUSTOM', 'qa' );`

Or set it with a filter, which wins over the constant:

`add_filter( 'kitaris_environment_indicator_custom', function () { return 'qa'; } );`

It is shown with the Custom color and labeled with the name ("client-review" shows as "Client Review"), unless you set a Custom label in the settings.

= For developers =

Set labels and colors in code. The filter receives the saved settings, keyed by `local`, `development`, `staging`, `production` and `custom`, and what it returns wins over the settings page:

`add_filter( 'kitaris_environment_indicator_config', function ( $config ) { $config['staging'] = [ 'text' => 'QA', 'color' => '#0891b2' ]; return $config; } );`

Remove the settings page (saved settings still apply):

`add_filter( 'kitaris_environment_indicator_settings_page', '__return_false' );`

Who sees the badge is filterable; for example, administrators only:

`add_filter( 'kitaris_environment_indicator_show', function ( $show, $environment ) { return current_user_can( 'manage_options' ); }, 10, 2 );`

Return `false` from the same filter to hide the badge.

= Disclaimer =

This software is provided "as is", without warranty of any kind, express or implied, including the warranties of merchantability and fitness for a particular purpose. To the extent permitted by applicable law, the authors and copyright holders, together with their parent, subsidiary, and affiliated companies and contributors, are not liable for any direct, indirect, incidental, or consequential damages arising from its use or inability to use it, including loss of data, revenue, or site availability.

The software does not guarantee that your site is secure, ranks in search results, or complies with privacy or other laws; that remains the site owner's responsibility. AI-generated content can be inaccurate and should be reviewed before publishing. Third-party services the software connects to are governed by their own terms.

Keep a current backup and test changes on a staging site before applying them to a live site. See sections 15 and 16 of the GNU General Public License, version 3, for the full terms.

== Frequently Asked Questions ==

= The badge does not appear. =

It is only shown to users who can edit posts (contributors, authors, editors and administrators), and only while the admin bar is showing.

= Does it add anything for visitors? =

No. The badge and its styles are only output for users allowed to see it.

== Screenshots ==

1. Settings → Environment Indicator: a label, dot color and live preview for each environment.
2. The badge on a production site.
3. The badge on a staging site.
4. The badge on a development site.
5. The badge on a local site.
6. A custom environment with its own label.

== Changelog ==

= 1.0.4 =
* The WordPress.org plugin has no Update URI header
* The WordPress.org zip leaves out .gitattributes
* The label preview matches the saved badge, including code overrides
* Stay inactive with a notice when bundled files are missing

= 1.0.3 =
* Maintenance release.

= 1.0.2 =
* Maintenance release.

= 1.0.1 =
* Drop the Update URI header from the WordPress.org plugin
* Set Update URI so wordpress.org never offers updates for this plugin

= 1.0.0 =
* Initial release.