如何在一页wordpress中禁用所有脚本和样式表

如何防止wordpress加载js文件和css文件的所有调用。这样,您只有生成wordpress的html文件? 更确切地说,我正在使用儿童主题。我可以编辑function.php文件。我用过的:
wp_deregister_style( '(the handle) ' ); wp_dequeue_style("(the handle)"); wp_dequeue_script( '(the handle)' ); wp_deregister_script('(the handle)');
但对于许多句柄却不起作用,我搜索(如果存在)一个脚本来删除所有呼叫的脚本。

PEIYOUXIANG 回答:如何在一页wordpress中禁用所有脚本和样式表

在您的WordPress 子主题内。

function childtheme_prefix_remove_scripts() {
    if ( is_page(25655) ) {
        wp_dequeue_style( 'handle' );
        wp_dequeue_script( 'handle' );
    }
}
add_action('wp_enqueue_scripts','childtheme_prefix_remove_scripts',999);
本文链接:https://www.f2er.com/2890513.html

大家都在问