Search code examples
htmlwordpressheaderwordpress-themingwordpress-gutenberg

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


I just want some clarification and advice regarding this tag in WordPress.

This tag is showing in my WordPress head even I'm not using Gutenberg.

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

Is this necessary or required? Do I need to remove this to improve page speed?
Is there any effect if I remove this tag?

Please enlighten me.

Thank you


Solution

  • I use to remove this stylesheet on websites which are not using Gutenberg.

    I don't think there is other effect than removing this stylesheet, you can do it safely.

    To go a bit further, you can remove it only for some post types like

    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' );