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

Was thinking about this : dequeue or enqueue scripts with IE for example. They say we can use global $is_IE; but that's wrong simply because it's not compatible with caching. Nowadays cache is everywhere !

Does someone have an idea about this?

I mean if I want some styles in IE8 I can do this :

add_action( 'wp_head', '_load_ie_styles' );
function _load_ie_styles() {
  global $wp_styles;
  wp_register_style( 'ie8', get_stylesheet_directory_uri().'/css/style-ie8.css' );
  $wp_styles->add_data( 'ie8', 'conditional', 'if IE 8' );
  wp_enqueue_style( 'ie8' );

Ok that's cool ! Maybe if I want something to avoid IE I can do this (not tested) :

add_action( 'wp_head', '_load_ie_styles' );
function _load_ie_styles() {
  global $wp_styles;
  wp_register_style( 'not-ie', get_stylesheet_directory_uri().'/css/style-not-ie.css' );
  $wp_styles->add_data( 'not-ie', 'conditional', 'if !IE' );
  wp_enqueue_style( 'not-ie' );

But how to do this with scripts? How can I dequeue scripts condionnally (IE) ?

Hope I'm clear. Does someone have any thought about this?

share|improve this question
Seems there's an explanation here – JMau Jan 20 '14 at 22:48

Your Answer


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

Browse other questions tagged or ask your own question.