Skip to content

Instantly share code, notes, and snippets.

@spacedmonkey
Last active July 11, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacedmonkey/6d0b395df4664040df9095fdd54a1562 to your computer and use it in GitHub Desktop.
Save spacedmonkey/6d0b395df4664040df9095fdd54a1562 to your computer and use it in GitHub Desktop.
Change the admin theme depending on enviroments in WordPress
<?php
add_filter( 'get_user_metadata', function ( $value, $object_id, $meta_key, $single ) {
if ( 'admin_color' !== $meta_key || ! $single ) {
return $value;
}
if ( ! defined( 'WPCOM_IS_VIP_ENV' ) ) {
return $value;
}
switch ( WPCOM_IS_VIP_ENV ) {
case 'develop':
$value = 'light';
break;
case 'preprod':
$value = 'blue';
break;
case 'production':
$value = 'sunrise';
break;
}
return $value;
}, 999, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment