5ucms论坛
标题:
wp_deregister_script()函数 去除WordPress本身自带的一些js文件
[打印本页]
作者:
admin
时间:
2021-6-1 10:58
标题:
wp_deregister_script()函数 去除WordPress本身自带的一些js文件
一把情况下,我们制作的WordPress主题的前端会加载一些比如jquery文件,这些文件可能与我们的前端源码有冲突导致网页显示不正常,这时候可以使用这个函数来去除冲突的WordPress自带JS文件。
语法
wp_deregister_script( string $handle )
参数
$handle (字符串) (必须) 此处为要移除的脚本handle名称。默认: None
实例
if ( !is_admin() ) {
function my_init_method() {
wp_deregister_script( 'jquery' );
}
add_action('init', 'my_init_method');
}
复制代码
欢迎光临 5ucms论坛 (http://bbs.5ucms.com/)
Powered by Discuz! X3.2