Admin & Dashboard PHP Beginner

Set a Default Admin Colour Scheme for New Users

Give every new user a chosen wp-admin colour scheme, such as Midnight or Modern, instead of the default.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 4 lines
add_action( 'user_register', function ( int $user_id ): void {
	// Options: fresh (default), light, modern, blue, coffee, ectoplasm, midnight, ocean, sunrise.
	update_user_meta( $user_id, 'admin_color', 'modern' );
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

A consistent admin colour scheme across a team or for clients makes screenshots and support easier. Users can still change it on their profile; this just sets where they start.

How it works

When a user is created, the user_register action saves the admin_color user setting. WordPress reads it on every admin page to load the matching stylesheet.

Things to watch

  • Existing users keep their current scheme. To change everyone at once, run wp user meta update for each user, or loop over get_users() once.
  • To hide the colour scheme picker from profiles, add remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );.

How to test it

Create a new user, log in as them and check the admin colours.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only