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.
Opens WPIDE on
Code
// 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 add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.