Removing Block Editor Stylesheet

Last year when WordPress 5.0 came out, I wrote a simple post showing how to continue using Classic Editor on your WordPress site. Unfortunately though, even after switching to classic editor your site will continue to load the default stylesheet for “Block Editor” aka Gutenberg. I recently noticed the following tag on my site and I had to figure out a way to remove it as I am using the classic editor only and loading this stylesheet all the time does not help my site anyway.

<link rel="stylesheet" id="wp-block-library-css" href="style.min.css" />

This is a sample tag and it will have few other attributes (type, media) which I did not add willingly but you got the idea. Here is the snippet that will get your job done on the fly. However, I honestly think little explanation is necessary.

add_action('wp_enqueue_scripts', function() {
}, 100);

All you have to do now is simply copy this snippet and paste it on your current theme’s functions.php page.


Please note that I have used wp_enqueue_scripts hook over wp_print_styles to dequeue the block stylesheet. Though both the hook will get your job done, it is highly recommended to use the first one. I came across a stackoverflow thread on this topic and it seems like the correct answer also suggested to use the print styles hook. Though technically it is not wrong, one should consider using the enqueue scripts hook, especially if you are planning to add or remove scripts and styles for front-end purpose.

Note: It is not recommended to use this snippet if Block Editor is being used on a WordPress site.

Today In History



Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.