Loading admin only styles in WordPress

Sometimes you need to overwrite various styles in the WordPress admin. The WP admin doesn’t load your theme style sheets, so the best way I found of doing this is hooking to theĀ admin_print_styles action. Add the following to your theme’s functions.php

function kb_add_admin_styles() {
	if (is_admin()) {
		wp_enqueue_style('my-css-name', get_stylesheet_directory_uri().'/custom.css', false, false, false);
add_action('admin_print_styles', 'kb_add_admin_styles');


Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

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