# Different Admin Color Scheme per Environment

> Switches the admin color scheme automatically on local, development and staging sites, so nobody mistakes a test copy for the live site while editing.

- Type: PHP
- Runs: Run everywhere
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: environment, staging, admin-colors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/env-admin-color-by-environment/

## Code

```php
// Admin color scheme per environment type.
$wpide_env_colors = array(
    'local'       => 'ocean',
    'development' => 'ectoplasm',
    'staging'     => 'sunrise',
);

add_filter( 'get_user_option_admin_color', function ( $color ) use ( $wpide_env_colors ) {
    $environment = wp_get_environment_type();

    return isset( $wpide_env_colors[ $environment ] ) ? $wpide_env_colors[ $environment ] : $color;
} );
```

## Notes

Production keeps each user's own choice; change the schemes in $wpide_env_colors (fresh, light, modern, blue, coffee, ectoplasm, midnight, ocean, sunrise).

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Different Admin Color Scheme per Environment" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
