如何防止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)');
但对于许多句柄却不起作用,我搜索(如果存在)一个脚本来删除所有呼叫的脚本。
如何在一页wordpress中禁用所有脚本和样式表
•
问答
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);