Remove Gutenberg CSS Remove Gutenberg CSS wordpress wordpress

Remove Gutenberg CSS


I'm adding this as a more complete answer than my comment:

You need to remove the -css when trying to dequeue the script. That's added to the HTML markup and not the actual tag for the css file.

If you search the code (the location of the enqueue may change as Gutenberg gets rolled into core), you can find:

wp_enqueue_style( 'wp-block-library' );

As you can see, there is no -css. This solution may work for other plugins that people have trouble dequeuing styles.

Edit:Since this still gets some traction, here is the code to handle it:

add_action( 'wp_print_styles', 'wps_deregister_styles', 100 );function wps_deregister_styles() {    wp_dequeue_style( 'wp-block-library' );}


I am use this code to to remove default style.

//Disable gutenberg style in Frontfunction wps_deregister_styles() {    wp_dequeue_style( 'wp-block-library' );}add_action( 'wp_print_styles', 'wps_deregister_styles', 100 );


I use Wordpress 5.1. Tried the most upvoted answers and they didn't work for me, 'wp_enqueue_scripts' instead of 'wp_print_styles' does the trick.

Here is my whole WordPress 5.1 solution to get rid of Gutenberg without bloat stylesheets loading:

// 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}

Edit:

It works with WordPress 5.2 as well and because it handles the stylesheets added by WooCommerce and Storefront theme, I made this one of the settings in my new plugin:

https://wordpress.org/plugins/extra-settings-for-woocommerce/