How to Stop User From Changing Color Scheme in WordPress

How to Stop User From Changing Color Scheme in WordPress

Sometimes, you want to set a default WordPress admin color scheme for
new users or specific users. Or you might want to stop users from
changing the colour. What you just need to do is to put the code below
in your theme’s functions.php file or in a site-specific plugin:

function 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'); 

Also, this code will not stop users from choosing another admin color scheme.
But users can still go and choose another color scheme they like from their profile
section.

Read: How to add Favicon to your WordPress site

How to Stop Users From Switching Admin Color Schemes 

Should you 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:

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

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Please follow and like us:
error
Also Read  Proper way on How to create pages in WordPress

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu
×
×

Cart

Spelling error report

The following text will be sent to our editors: