WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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' );
share|improve this answer
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 '12 at 15:01
!is_admin is right, but theme review standards suggest all scripts and stylesheets should be added to the wp_enqueue_scripts hook – helgatheviking Feb 7 '12 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.

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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