wordpress 5.0+禁止加载wp-block-library-css
WordPress5.0+出了个死难用的新版编辑器,默认会在头部加载新版样式
<link rel='stylesheet' id='wp-block-library-css' href='http://test.blyoo.com/blog/wp-includes/css/dist/block-library/style.min.css?ver=5.0.3' type='text/css' media='all' />
在functions.php函数文件里添加以下去除默认样式
高级版-大神专用版:
//WordPress 5.0+移除 block-library CSS
add_action( 'wp_enqueue_scripts', 'remove_block_library_css', 100 );
function remove_block_library_css() {
wp_dequeue_style( 'wp-block-library' );
}
简写版-懒人专用版:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'wp-block-library' );
} );
更多WordPress相关问题看:https://github.com/WordPress/gutenberg/issues