WordPress 5.0+ 移除 block-library/style.min.css
WordPress 5.0 自动引入block-library/style.min.css
的 CSS 文件。
<!--WordPress 5.0+前端页面自动引入的CSS 文件--> <link rel='stylesheet' id='wp-block-library-css' href='http://aihongxin.com/wp-content/wp-includes/css/dist/block-library/style.min.css?ver=1514439988' type='text/css' media='all' />
由于新版编辑器不为大多数用户所接受,或者基本上都会自定义样式,所以也就显得十分鸡肋。
下面就是移除block-library/style.min.css的方法:
//WordPress 5.0+移除 block-library CSS add_action( 'wp_enqueue_scripts', 'tonjay_remove_block_library_css', 100 ); function tonjay_remove_block_library_css() { wp_dequeue_style( 'wp-block-library' ); }
请将以上代码添加到主题 functions.php 中就可以了