Wordpress 3.4取消注册jQuery

时间:2012-07-12 09:29:34

标签: wordpress wordpress-theming

将WP从3.3升级到3.4 wp_deregister_script('jquery');似乎不再起作用了(WP提供的jQuery在部分中可见)。

取消注册脚本包含在我主题的functions.php文件中,如下所示:

    if( !is_admin()){
    wp_deregister_script('jquery');
}

升级后我试图自定义,但实际上没有任何效果。例如,我也尝试将脚本出列,但仍然没有。

if( !is_admin()){
    wp_deregister_script('jquery');
    wp_dequeue_script('jquery');

}

期待您的意见和任何可能的解决方案。

1 个答案:

答案 0 :(得分:4)

使用hook执行此操作

add_action( 'admin_enqueue_scripts', 'my_enque_func' );
function my_enque_func()
{
    wp_deregister_script('jquery');
    wp_register_script(...); // Register your own script
}

关于wp_register_script