Andrej V.
Andrej V.

Reputation: 53

How to remove wordpress default jquery

I have troubles with Wordpress. I need to remove this includions

*-> /wp-includes/js/jquery/jquery.js?ver=1.12.4<br>
-> /wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1*

As you can see on the picture below, I'm using own compiled and minified version of scripts, where I also have jquery...

I would like to remove that older default wordpress version from including.?

enter image description here

Here is some code that I have tried before posting this:

function my_jquery_enqueue() {
    wp_deregister_script('jquery');
}

add_action( 'wp_jquery_customer', 'my_jquery_enqueue' );
add_action( 'wp_nopriv_jquery_customer', 'my_jquery_enqueue' );

Thanks for helping. :)

Upvotes: 0

Views: 7107

Answers (1)

kashalo
kashalo

Reputation: 3562

you need to use wp_enqueue_scripts

so your function should look like this:

function my_jquery_enqueue() {
    wp_deregister_script( 'jquery' );
}

add_action( 'wp_enqueue_scripts', 'my_jquery_enqueue' );

More Details your can read about wp_enqueue_scripts at:

Reference

Upvotes: 3

Related Questions