Remove the Gutenberg Block Library CSS from WordPress

If you’re addicted to making your WordPress site as fast as possible you may have noticed a bit of CSS from Gutenberg. Every request on your site will slightly slow down your pages so if you’re not using Gutenberg you’ll want to remove Gutenberg CSS.

You can remove Gutenberg CSS by using the PHP below to dequeue the “/wp-includes/css/dist/block-library/style.min.css” file.

// Fully Disable Gutenberg editor.
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Don't load 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

Leave a Reply

Your email address will not be published. Required fields are marked *