WordPress 移除 head 代码 classic-theme-styles-inline-css 的方法
文章摘要
随着 WordPress 程序的不断更新,越来越多的冗余代码出现在了源码的 head 中,比如下面这块是自带的主题内联样式: style id=classic-theme-styles-inline-css /! This file is auto-generated / .wp-block-button__link{color:#fff;backg...
随着 WordPress 程序的不断更新,越来越多的冗余代码出现在了源码的 head 中,比如下面这块是自带的主题内联样式:
<style id="classic-theme-styles-inline-css">
/*! This file is auto-generated */
.wp-block-button__link{color:#fff;background-color:#32373c; ... ... ... ... }
/*# sourceURL=/wp-includes/css/classic-themes.min.css */
</style>
快速移除方法:
复制以下代码到主题的 functions.php 文件中的最后即可,
// 移除 classic-theme-styles-inline-css
add_action('wp_enqueue_scripts', function () {
wp_dequeue_style('classic-theme-styles');
wp_deregister_style('classic-theme-styles');
}, 100);
提示:如果不能立即生效,多半是你的缓存插件或CDN需要清除一下缓存后再试。
原文地址: https://themebetter.com/wordpress-remove-classic-theme-styles-inline-css.html
手机扫码阅读
微信或手机浏览器扫一扫,随时随地随心阅读与分享
收藏
0
版权所有:麒麟吧
文章标题:WordPress 移除 head 代码 classic-theme-styles-inline-css 的方法
文章链接:https://qilinba.com/160
本站文章均为原创,未经授权请勿用于任何商业用途
文章标题:WordPress 移除 head 代码 classic-theme-styles-inline-css 的方法
文章链接:https://qilinba.com/160
本站文章均为原创,未经授权请勿用于任何商业用途
发表评论