How to Add Custom CSS to the WordPress Admin Area
By default, WordPress provides a clean admin dashboard, but sometimes you may want to customize its appearance. For example, you might want to highlight specific post types, hide elements for certain users, or adjust spacing. The easiest way to do this is by adding custom CSS to the WordPress admin area.
Method 1: Using admin_enqueue_scripts in functions.php
You can load a custom stylesheet specifically for the admin dashboard by enqueueing it in your theme or plugin.
// Add custom admin CSS
function my_admin_custom_css() {
wp_enqueue_style(
'my-admin-style',
get_template_directory_uri() . '/admin-style.css'
);
}
add_action('admin_enqueue_scripts', 'my_admin_custom_css');
In this example:
- Create a file called
admin-style.cssin your theme folder. - Add your custom CSS rules there.
- They will only apply inside the WordPress admin area.
Method 2: Adding Inline CSS with a Hook
If you only need a few CSS tweaks, you can add inline CSS directly in your functions.php file:
// Add inline admin CSS
function my_custom_admin_css() {
echo '<style>
#wpadminbar { background: #23282d; }
.wrap h1 { color: #0073aa; }
</style>';
}
add_action('admin_head', 'my_custom_admin_css');
This method is quick and doesn’t require creating a separate file, but it’s less maintainable for larger changes.
Method 3: Using a Plugin
If you prefer not to edit code, you can use a plugin such as:
- Admin CSS MU – lets you add custom CSS to the admin area.
- Simple Custom CSS – adds CSS site-wide, but can be extended to admin.
These plugins give you a user-friendly editor to paste your CSS without touching theme files.
Examples of Useful Admin CSS
/* Hide WordPress logo in admin bar */
#wp-admin-bar-wp-logo { display: none; }
/* Highlight pending posts in post list */
.status-pending { background: #fff3cd; }
/* Change background color of the dashboard */
#wpbody-content { background: #f9f9f9; }
Summary
You can add custom CSS to the WordPress admin area by enqueueing a stylesheet, inserting inline styles, or using a plugin. For larger projects, enqueueing a dedicated admin-style.css file is the most flexible solution. This allows you to personalize the dashboard, improve usability, and give clients a tailored WordPress admin experience.
🎨 Want to learn more? Visit our WordPress Customization Hub for tips and advanced techniques.