I have been using the following function to enqueue some CSS to my theme. However, they are used in the admin area as well:


I don't want them to be used in the admin area. Sadly I cannot find anything about that neither here nor on Google in combination with this function. The codex doesn't explain it as well and the function does not support an option to apply to a specific style the exclusion of the admin area.

I hope somebody could tell me how to exclude a specific css from the admin area.

Thanks in advance.

3 Answers 3


There are a couple of options. One is to wrap the enqueue in a check to see if it is the admin.


The other is wait to enqueue the style until template_redirect.

function my_enqueue_styles() {    
add_action( 'template_redirect', 'my_enqueue_styles' );
  • thanks, pretty much to everybody. I go with the highly recommended !is_admin(). Quite stupid that I didnt think of that - very easy : )
    – Richard
    Feb 7, 2012 at 15:01
  • 2
    !is_admin is right, but theme review standards suggest all scripts and stylesheets should be added to the wp_enqueue_scripts hook Feb 7, 2012 at 15:28

You can make your enquques conditional, for example: if( !is_admin() ) { wp_enquque_style( 'my_style' ) }. Any of the conditional tags will work in this way.


can you please show the exact code you're using?

If you are doing something like this:

wp_register_style('mycssname', "/wp-content/themes/[theme]/css/screen.css",array(),'false','screen');

you could do this:

if ( !is_admin() ) {
    wp_register_style('mycssname', "/wp-content/themes/[theme]/css/screen.css",array(),'false','screen');

.. or you might want to look at http://codex.wordpress.org/Function_Reference/wp_deregister_style

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.