[英]How to remove wordpress default jquery
I have troubles with Wordpress. 我在使用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... 如您在下面的图片中看到的,我使用的是自己编译和缩小版本的脚本,在这里我也有jquery ...
I would like to remove that older default wordpress version from including.? 我想从中删除旧的默认wordpress版本。
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. 感谢您的帮助。 :) :)
you need to use wp_enqueue_scripts
您需要使用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: 您可以在以下位置阅读有关wp_enqueue_scripts
更多详细信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.