Tuesday , February 4 2025

How to add custom CSS for WordPress admin panel

If you need to place a few CSS lines for the admin panel, then edit the file functions.php at the root of the theme, and add it to the end of the file:

add_action('admin_head', 'admin_styles');

function admin_styles() {
    echo '<style>
        .update-nag {display: none !important;}
    </style>';
}

Instead of the .update-nag {display: none !important;} paste your actual values.

If you need to include a CSS file, in the same place in functions.php add this one:

add_action('admin_head', 'admin_styles');

function admin_styles() {
    echo '<link rel="stylesheet" href="newstyle.css" type="text/css" media="all" />';
}

In this case, the newstyle.css file must be placed in the same folder, next to functions.php. You can also set the path from the site root to another folder where you store CSS: /wp-content/themes/yourtheme/folder/

About iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

Check Also

How to open html pages without .html

If your site uses links like http://domain.com/testpage.html and http://domain.com/demo.html, and you want them to open …

Leave a Reply

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