add css in wordpress admin dashboard

Add CSS in Wordpress Admin Dashboard

You rarely need to add CSS in WordPress Admin dashboard, Add if you do there is no easy way to do it like frontend.

It turns out it’s not that hard,

All you have to do is add your CSS with a function in theme’s functions.php file, Similar to below…

add_action('admin_head', 'my_custom_notification');
function my_custom_notification() {
  echo '<style>

    /* Your CSS here */

  </style>';
}

Here is an example if you want to hide notification from a plugin asking you to upgrade and you can’t simply hide that notification.

add_action('admin_head', 'my_custom_notification');
function my_custom_notification() {
  echo '<style>
  
  .notice-error {
    display: none;
}

  </style>';
}

When it is Useful to add CSS in WordPress Admin Dashboard

Let’s say you install a free plugin from the WordPress repository and plugin is showing you ads and notifications which are just annoying.

Sometimes plugin developers don’t just let you hide those ads, Using CSS in such cases to hide such ads is quite handy.

I am not saying plugin or theme developers shouldn’t ask to upgrade to premium version but sometimes it’s just too much.

And, users won’t just buy something just because they saw annoying ads unless they actually need what devs are selling in premium version.

Personal Touch and Branding

If you are designing a website for clients, You can add/ change certain elements to match your brand or clients own brand or colors similar to frontend and so on.

If you have any questions, then please leave them in the comments. If you know about other methods to add CSS in the WordPress admin dashboard, please share it with us in the comments below.

3 Comments

  1. You are awesome dude. I am frontend developer and I don’t like Wordpress Admin dashboard UI and just wanted an easy way to make changes for my clients and make it more personal to them.

Leave a Reply

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