Remove Gutenberg stylesheet from WordPress website

Remove Gutenberg stylesheet from WordPress to make the website lighter and load faster.

Thus, WordPress 5.0 has officially been launched for nearly 3 weeks. And since then, the number of people who install Classic Editor plugin to switch to using the classic editor of WordPress has also increased dramatically (more than 1 million websites are activating this plugin), enough to see How Gutenberg lost his heart. Not only is it annoying and inconvenient to use, Gutenberg also "silently" uploads his stylesheet to the front-end of the website, making the WordPress source code more cumbersome.

What is the Gutenberg stylesheet?

There are 2 CSS files, including wp-block-library-cssand wp-block-library-theme-css, automatically downloaded on all websites using WordPress version 5.0 and above. They are still loaded even if you don't use the Gutenberg editor or have installed the plugin to replace it with the Classic Editor.

Although these 2 files are not large, they will also affect the speed of website loading. Therefore, if you don't use Gutenberg, it's best to disable them.

How to remove Gutenberg stylesheet?

For regular theme

Very simple! All you need to do is insert the following code at the end functions.phpof the theme file (or child theme) you are using and save it.

// * Disable Gutenberg stylesheet in front
function wps_deregister_styles () {
    wp_dequeue_style ('wp-block-library');
    wp_dequeue_style ('wp-block-library-theme');
add_action ('wp_print_styles', 'wps_deregister_styles', 100);

For Paradise theme

We have built this feature in Paradise child theme since version 5.2.2. Therefore, you just need to access Appearance => Customize => Performance => Remove Remove Gutenberg stylesheet item ? It is Yesokay to save and save.

Check the result
Clear the website cache, browse the web browser and check the results. If nothing changes, the two lines of Gutenberg stylesheet will disappear when you view the source website.

Isn't it great? Good luck!

If you like this post, please subscribe to my blog to regularly update the best, latest posts via email. Thanks very much. :)
Related Posts

Related Posts

Post a Comment