wordpress模版中有许多没用的代码,比如头部内联样式 global-styles-inline-css和duotone svg等。那么我们如何屏蔽/去除这些内联代码呢?下面给大家简单介绍一下具体实现方法!
在当前主题的functions.php文件中新增以下代码:
//移除头部global-styles-inline-css
add_action('wp_enqueue_scripts', 'remove_global_styles_inline');
function remove_global_styles_inline(){
wp_deregister_style( 'global-styles' );
wp_dequeue_style( 'global-styles' );
}
//wp-block相关的冗余代码
add_action('wp_enqueue_scripts', 'remove_styles_inline');
function remove_styles_inline(){
wp_deregister_style( 'global-styles' );
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' );
}
Internet Archive Wayback Machine Link Fixer插件下载入口
WordPress建站中如何把the_excerpt()内容中的html标签去掉
WordPress建站模版获取上一篇/下一篇文章的标题和链接的几种方法
wordpress建站,不要第三方插件实现图片自动添加水印(亲测有效)
上面是“wordpress如何屏蔽/移除内联样式”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3928.html
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

vuejs一行代码判断当前设备是移动端还是pc端
vue缓存组件的正确写法及基本介绍 










