我需要删除这个 wp-block-library-css (Gutenberg CSS) 吗?

Do i need to remove this wp-block-library-css (Gutenberg CSS)?

我只想得到有关 WordPress 中此标签的一些说明和建议。

即使我没有使用古腾堡,这个标签也会显示在我的 WordPress 头上。

link rel="stylesheet" id="wp-block-library-css"

这是必要的还是必需的? 我需要删除它以提高页面速度吗?
去掉这个标签有什么影响吗?

请赐教

谢谢

我曾经在不使用 Gutenberg 的网站上删除此样式表。

我认为除了删除此样式表之外没有其他效果,您可以安全地进行。

更进一步,您可以仅针对某些 post 类型删除它,例如

function remove_wp_block_library_css() {
  if( !is_singular('post') ) {
    wp_dequeue_style( 'wp-block-library' );
  }
}
add_action( 'wp_enqueue_scripts', 'remove_wp_block_library_css' );

如果您根本不使用古腾堡,您可以像这样进一步卸载样式:

// Unload Gutenberg-related stylesheets.
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_block_css() {
    wp_dequeue_style( 'wp-block-library' ); // Wordpress core
    wp_dequeue_style( 'wp-block-library-theme' ); // Wordpress core
    wp_dequeue_style( 'wc-block-style' ); // WooCommerce
    wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
}