How to Add CSS Styles to WordPress Admin

WordPress has obviously grown from a personal blogging tool to a collaborative blogging environment with multiple authors and multiple blogs in a network with the WordPress multisite.

This sometimes call for styling not only your front end for your visitors, but also the backend of your WordPress admin.

To add admin styles to make some tweaks here and there, like hiding some stuff using display:none or something of that sort, here is what you need to do.

Add the following snippet into the functions.php of your active theme:

/** 
* Add CSS to WordPress Admin
* 
* @refer https://millionclues.com?p=2989
*/
function load_custom_admin_css() {
  
  wp_enqueue_style('my_custom_admin_css', WP_CONTENT_URL . '/themes/custom_admin.css');
}
add_action( 'admin_enqueue_scripts', 'load_custom_admin_css' );

Now create a custom_admin.css in your wp-content/themes/ folder and add all the custom css you want in there.

For instance, to hide the Plugins section from the Admin sidebar, you would add to your custom_admin.css:

#menu-plugins {
  display:none !important;
}

Of course, like all things CSS, this is a cosmetic change. The plugins area would still be accessible via a direct link. If you wish to remove them or show them based on user-role, Admin Menu Editor can do that for you.

Have fun. Out.

Update: If you want this to be theme independent, I have a cute plugin for you: Admin CSS MU. Check it out.

Hello, I am Arun Basil Lal. Thank you for reading!

I am a WordPress product developer and creator of Image Attributes Pro. I am passionate about solving problems and travelling the world.

Divi WordPress Theme - My Review

Divi WordPress Theme
Divi is a WordPress theme that web designers do not want you to know. It comes with a drag-and-drop theme builder. You can build beautiful looking unique websites without touching a line of code. Just choose from one of the many pre-made layouts, or pick elements and arrange them any way you like.

Divi is every WordPress developer's wet dream. Surprise your clients with neat responsive websites and have fun building them.

Divi comes from Elegant Themes. If you enjoy building websites, you *need* an Elegant Themes membership. 87 beautiful themes and 5 plugins for the cost of less than a candy-bar each!


Note: I am an avid user of Divi myself and this is a honest review. I wouldn't recommend something that I do not personally find amazing.

1 Comment.

  1. Juan says:

    Thanks, good tip!

1 Pings / Trackbacks.

  1. […] WP-Admin By Arun Basil Lal | Published: July 3, 2012 I had written on how to load CSS on the admin side before. This involved adding the load function into the functions.php of the […]

Leave a Reply

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

*