How to Set Default Admin Color Scheme for New Users in WordPress

///How to Set Default Admin Color Scheme for New Users in WordPress

How to Set Default Admin Color Scheme for New Users in WordPress

One of the most talked about feature of WordPress 3.8 is the new admin interface. It is fully responsive and looks great on all devices. If you don’t like the default colors, then you can choose from 8 different admin color schemes and even add new ones. In this article, we will show you how to set a default admin color scheme in WordPress for new users. We will also show you how to prevent users from changing the default WordPress admin color scheme.

 

admin-color-scheme

In order to set a default WordPress admin color scheme for new users, all you need to do is add the following code in your theme’s functions.php file or in a site-specific plugin:

 

remove-admin-color-scheme

1 function set_default_admin_color($user_id) {
2     $args = array(
3         'ID' => $user_id,
4         'admin_color' => 'sunrise'
5     );
6     wp_update_user( $args );
7 }
8 add_action('user_register', 'set_default_admin_color');

 

This code changes the default WordPress admin color scheme to Sunrise for each new user who registers on your site. It does not change the color scheme for previously registered users. Also, this code will not stop users from choosing another admin color scheme. Users can still go to their profile section and choose any other color scheme they like.

How to Stop Users From Switching Admin Color Schemes

If you would like to set a default color scheme for your site and do not want users to use any other color scheme, then all you have to do is add the following code in your theme’s functions.php file or in a site-specific plugin:

1 if ( !current_user_can('manage_options') )
2 remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

 

remove-admin-color-scheme

 

This code will remove the admin color scheme picker from the profile screen of all users except users with administrator privileges.

We hope this article helped you set a default WordPress admin color scheme and disable the color scheme picker from user profiles on your WordPress site.

If you could change the default admin color scheme, which color scheme would you pick? Let us know by leaving a comment below.

Content Source
2018-07-20T04:41:02+00:00By |Support, Wordpress|0 Comments