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 load 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 Gutenberg blocks but if you are using the classic editor you most likely don’t want it loading the block library CSS 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 you won’t want to add this snippet to your site.
Dequeue Gutenberg Block Library CSS Code Snippet
This PHP snippet will work in your theme’s functions.php file or being added using a plugin like Code Snippets. Additionally from dequeuing core Gutenberg block CSS it will also remove the WooCommerce block CSS.
If you ever decide to start using the Gutenberg editor just remember to remove this snippet since it’ll affect your blocks from working correctly.
Dequeue Gutenberg Block Library CSS with Asset CleanUp Plugin
If you aren’t familiar with PHP or code snippets you can use a plugin like Asset CleanUp to dequeue the Gutenberg Block Library styles from your site.
Adding Asset CleanUp is as easy as installing a WordPress plugin to your site. Simply head to Plugins / Add New and search “Asset CleanUp”. After activating the plugin you’ll have a new Asset CleanUp option in the admin dashboard.
Under “Asset CleanUp > Settings > Site-Wide Common Unloads” you’ll find the “Disable Gutenberg CSS Block Library Site-Wide” option. After enabling it and updating all settings the block library will be removed from your site.
I hope this code snippet helped speed up your site! If you have any issues feel free to let me know in the comments below.