Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

We're currently rolling out a number (>100) of wordpress sites where we're using a custom child theme and a holding page plugin.

Most of our clients use IE8 as their browser (corporate policy) and unfortunately their appears to be a conflict between the holding page plugin and an external javascript file included by the parent theme, set in it's functions.php file.

wp_register_script('iejs', 'http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js');

I've tried to prevent the JS file from being called by adding

wp_deregister_script('iejs');
wp_dequeue_script('iejs');

N.B. I guess using but deregister and dequeue is overkill but I want to be sure I've de-registered it...

to the child theme functions.php but that didn't work (prevent the javascript file being called by wp_head), I read somewherre that child themes are called pre the parent theme so I tried

function SAH_dereg() {
    wp_deregister_script('iejs');
    wp_dequeue_script('iejs');
}
add_action( 'after_setup_theme', 'SAH_dereg' );

to force it to de-register the script after the theme loads but before it displays, but that didn't work either.

We could of course just remove the line from the parent theme and ignore any updates until after we've sign off from our clients. But I'd prefer a more elegant solution.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This is not th right hook, try wp_enqueue_scriptsinstead :

add_action( 'wp_enqueue_scripts', 'SAH_dereg' );
share|improve this answer

Your Answer

 
discard

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.