The new WordPress editor Gutenberg which was included in WordPress 5.0 has been loathed by many WordPress users. Whether you’re a fan or not millions have been moved to the new WordPress editor.
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.
This provides support to blocks but if you are using the classic editor you most likely don’t want it loading with your pages. I noticed the “block-library/style.min.css” file loading even though I exclusively use the classic editor.
You can remove Gutenberg CSS by using the PHP below to dequeue the “/wp-includes/css/dist/block-library/style.min.css” file.
Note: If you are using Gutenberg editor do not add this to your site.
This PHP will work in your functions.php file or being added using a plugin like Code Snippets.
|wp_dequeue_style( 'wp-block-library' );|
|add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );|
If you ever decide to use the Gutenberg editor just remember to remove this snippet since it’ll affect your blocks.