如何在一页wordpress中禁用所有脚本和样式表
how to disable all script and stylesheet in one page 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)');
但对于许多句柄不起作用,我搜索(如果存在)一个脚本,该脚本可以一次删除所有调用。
在您的 WordPress 子主题 functions.php 文件中:
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);
如何防止 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 子主题 functions.php 文件中:
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);