How to Add Custom CSS to Admin Area

Last modified Sep 10, 2020
Difficulty Intermediate
Language CSS, PHP
Category

You can stylize the dashboard admin area with the custom CSS. Here is the snippet code you need to paste into functions.php file. Replace the comment with your custom code.

“admin_head is an action event and can be hooked by add_action hook. The action refers on the admin area and everything you include here will be applied only on the admin side. ”

More information

 

PHP

add_action('admin_head', 'my_custom_acode');

function my_custom_acode() {
  echo '<style>
   /* your code here */
  </style>';
}

 

Does this snippet (still) work?

Please let us know in the comments if everything worked as expected. We have tested this code with the Version: 4.0.1 of the Divi Theme and Divi Friendly Hosting with PHP 7.3 and WordPress 5.2.4.
If you think this code saved you time, we will be happy to receive a comment! ?

____

License: This snippet is from https://codex.wordpress.org, copyright WordPress,  Licensed under the GNU General Public License, no warranty; click here for details.

Your Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Receive notifications about our new blog posts.