Remove Gutenberg Block Library CSS

3d Animation

If like me you absolutely hate the Gutenberg Block Editor in WordPress and by default install the Classic Editor, you may also want to remove the CSS that’s left behind in the background.

I found this code below from SmartWP – read more here. The reason I’ve started removing the Gutenberg CSS files is that I was getting odd CSS conflicts with images not resizing correctly in WordPress, it affected the CSS styling in my child theme.

Since I’ve removed the Gutenberg CSS files, my CSS-controlled images are now working and displaying correctly!

Here’s the code that prevents the Gutenberg CSS files from loading

Simply add this block of code to your function.php file in your WordPress child theme. Credit once again to SmartWP for the code.

//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
 wp_dequeue_style( 'wp-block-library' );
 wp_dequeue_style( 'wp-block-library-theme' );
 wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );