您可以安装如下插件asset Queue Manager 跟踪所有活动样式表和javascript文件(它非常整洁,您可以实时预览页面在没有资源的情况下的外观,以查看您的站点是否损坏),然后在主题中functions.php
文件中,输入如下代码
add_action( \'wp_print_scripts\', \'my_deregister_javascript\', 100 );
function my_deregister_javascript() {
$deregistered_scripts=array(\'wc-add-to-cart\',
\'woocommerce\',
\'storefront-skip-link-focus-fix\',
\'wc-add-to-cart-variation\',
\'wc-cart-fragments\',
\'storefront-navigation\',
\'wc-single-product\');
foreach ($deregistered_scripts as $key => $script) {
wp_deregister_script( $script );
}
}
(当然,您可能需要更换
$deregistered_scripts
仅包含不使用的数组)
如果您的博客处于开发模式,并且在此之后发现错误消息,则可能是某些插件导致了此问题。尝试将@添加到的第250行/wp-includes/class.wp-scripts.php
(我解决了woocommerce抛出的错误警告)
public function set_group( $handle, $recursion, $group = false ) {
if ( @$this->registered[$handle]->args === 1 ) //"@" added
$grp = 1;
else
$grp = (int) $this->get_data( $handle, \'group\' );
if ( false !== $group && $grp > $group )
$grp = $group;
return parent::set_group( $handle, $recursion, $grp );
}
Edit: 已从中添加注销脚本代码
this blog article by Justin Tadlock