Need To Deregister Scripts Via Functions.Php

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

Read More

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.

Related posts

1 comment

  1. 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' );
    
    }
    

Comments are closed.