Family Encyclopedia >> Electronics

How to set the default admin color scheme for new users in WordPress

One of the most talked about features 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, 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'll also show you how to prevent users from changing the default WordPress admin color scheme.

How to set the default admin color scheme for new users in WordPress

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

 función set_default_admin_color ($ user_id) $ args = array ('ID' => $ user_id, 'admin_color' => 'sunrise'); wp_update_user ($ args); add_action ('user_register', 'set_default_admin_color'); 

This code changes the default WordPress admin color scheme to Sunrise for every new user that signs up to your site. Does not change the color scheme for previously registered users. Also, this code will not prevent 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 prevent users from changing admin color scheme

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

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

How to set the default admin color scheme for new users in WordPress

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

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

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