1

Well, I am a little disappointed how difficult Wordpress it makes to deregister scripts.

First, I got a list of all handles, so I looked it up and the handle was jquery-migrate

I then added this to my functions.php

wp_dequeue_script('jquery-migrate');

Also this

wp_dequeue_script('jquery');

It does nothing, although the scripts are properly registered.

What's up with the version strings, I can think of no reasons why they are still including those, should be removed in the next WP version asap, they only prevent caches from properly caching it in some cases and are annoying.

Any input on how to "properly" deregister scripts is appreciated.

3
  • what action and priority have you hooked these to? are there other scripts declaring jquery as dependency?
    – Milo
    Nov 25, 2013 at 20:41
  • They are registered by 3rd-party plugins such as Nextgen Gallery and similar
    – mashup
    Nov 25, 2013 at 20:46
  • I mean what action and priority are you trying to dequeue them on? and what priority have they been originally enqueued with?
    – Milo
    Nov 25, 2013 at 20:52

1 Answer 1

3

Ok the following does work now, I think it was a caching issue and I forgot to add the correct priorities

Using the priorities now it definitely works and I also managed to de-register Buddypress scripts

add_action( 'wp_print_scripts', 'de_script', 100 );

function de_script() {
    wp_dequeue_script( 'jquery' );
    wp_deregister_script( 'jquery' );
     wp_dequeue_script( 'bp-legacy-js' );
    wp_deregister_script( 'bp-legacy-js' );

}
1
  • bp-legacy-js => is the handle for the buddypress
    – mashup
    Nov 25, 2013 at 20:56

Your Answer

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

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