Reputation: 11
I want to remove jQuery from Google CDN on my WordPress site. See here
I want to remove that, because I already have jquery script on my website. And also the jQuery from Google takes 1.1s too load. See here
I tried to add this script on the function.php
function my_init() {
if (!is_admin()) {
wp_deregister_script('jquery-js');
wp_register_script('jquery-js', 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js', false);
}
}
add_action('init', 'my_init');
But it's not working. So do you guys know how to remove the jQuery script from Google in Wordpress?
Upvotes: 0
Views: 446
Reputation: 382
have you tried deregister without .js ? like this:
wp_deregister_script('jquery');
Upvotes: 1