How to Absolutely Remove WordPress Gutenberg / Block Editor External CSS and Javascript Files

I’m not fan of WordPress automatically adding links to CSS and Javascript files to my sites. I take great care to score in the 90s, 100 even on Google’s Pagespeed, and to eliminate as many resources on a page as I can.

If the page doesn’t need it, I don’t want it to load. This drives me crazy when 3rd-party plugin developers who are doing something like adding a picture of a star or a popup screen or something then simply add their CSS and JS files to every single page. It’s poor development and, to me, is akin to a purchasing a travel trailer you intend to tow behind your F-150, but once you buy it the RV salesman also attaches one to every other vehicle you own — your hatchback, your motorcycle, your peddle bike. That is, making everything crushingly slow.

So now that WordPress itself is doing this, well, that raises some red flags and I really hope they backtrack a bit here. I mean, I don’t personally like the block editor anyway, but I definitely dislike it adding bloat to my sites.

So, here’s how to absolutely remove those files from your WordPress theme.

add_action( 'wp_enqueue_scripts', 'wp_juice_cleanse', 200 );
function wp_juice_cleanse() {


// This also removes some inline CSS variables for colors since 5.9 - global-styles-inline-css

// WooCommerce - you can remove the following if you don't use Woocommerce

// since 6.1 or so, WP has been adding this nonsense
wp_dequeue_style( 'classic-theme-styles' );


Note that this will also break the functionality, or at least the display, of anything created with the block editor. You can install the Classic Editor plugin. WordPress themselves say this will be supported until December 21st, 2021. Maybe by then, Gutenberg / the block editor will be awesome. Maybe it won’t add a bunch of bloat to our sites before any plugins or 3rd-party themes ever get involved. Maybe something else will come along and blow WP out of the water by then (doubtful though, given WP’s current 15 year run.)

If you don’t like plugins, a Stackoverflow post also states this is a viable way to remove the block editor from directly within your theme code.

// Disable Gutenberg editor.
add_filter('use_block_editor_for_post_type', '__return_false', 10);

I haven’t tested that specifically.

Up Next: How to Setup Basic Taxes in Woocommerce