Why Gutenberg CSS Still Loads With Classic Editor (And How to Remove It)
Content
Many WordPress users who install the Classic Editor plugin are surprised to discover that Gutenberg's block editor CSS files continue to load on their site's frontend. This is a common point of confusion that generates numerous support requests. This article explains why this happens and provides several methods to remove these unnecessary styles if you're certain your site doesn't need them.
Why Does Gutenberg CSS Still Load?
Based on discussions in the Classic Editor support forums, this behavior is intentional rather than a bug. The Classic Editor plugin team has deliberately chosen not to automatically dequeue Gutenberg assets for several important reasons:
- Backward Compatibility: If any posts on your site were previously created using the Gutenberg editor, those posts still require the block library CSS to display properly.
- Editor Switching: The plugin allows users to switch between editors on a per-post basis. If this option is enabled, the styles must remain available for posts that might use the block editor.
- Theme Requirements: Some themes may utilize block editor styles for their layout and design, even if you're using the Classic Editor.
As one support thread explains: "This disabling was discussed before and deemed 'unsafe' for most users as the plugin lets users choose which editor to use."
How to Remove Gutenberg CSS (If You're Sure You Don't Need It)
If you've confirmed that your site has never used Gutenberg, doesn't allow editor switching, and your theme doesn't require block styles, you can safely remove these assets using one of these methods:
Method 1: Add Code to Your Theme's functions.php
The most common solution is to add this simple code snippet to your theme's functions.php file:
add_action('wp_enqueue_scripts', function() {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
});
This will prevent both the main block library CSS and any theme-specific block styles from loading on the frontend.
Method 2: Create a Must-Use Plugin
For a more robust solution that won't be affected by theme changes, create a simple must-use plugin:
- Create a new PHP file in your /wp-content/mu-plugins/ directory (create the folder if it doesn't exist)
- Name the file something like remove-gutenberg-css.php
- Add the following code to the file:
<?php
/*
Plugin Name: Remove Gutenberg CSS
Description: Removes Gutenberg CSS when using Classic Editor
*/
add_action('wp_enqueue_scripts', function() {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
});
Method 3: Use a Dedicated Plugin
Several third-party plugins specialize in removing Gutenberg assets. Search for "disable Gutenberg CSS" in the WordPress plugin repository to find current options.
Important Considerations Before Removing CSS
Before implementing any of these solutions, consider these potential issues:
- If you ever switch to a block-enabled theme, you may need to reverse these changes
- Any existing posts created with Gutenberg will display incorrectly without the CSS
- Future WordPress updates might change how these assets are handled
As noted in the support threads, the Classic Editor plugin team has consciously avoided building this functionality directly into the plugin due to these potential compatibility issues. One thread states: "This is a 'very advanced feature' and would be pretty risky to break something, now or in the future."
For most users, the small performance impact of loading unused CSS is preferable to potentially breaking their site's display. However, if you're certain your site doesn't need Gutenberg styles, the methods above will safely remove them.
Related Support Threads Support
-
Deregister gutenberg scripts & styleshttps://wordpress.org/support/topic/deregister-gutenberg-scripts-styles/
-
Disable wp-block-library-csshttps://wordpress.org/support/topic/disable-wp-block-library-css/
-
Patterns menu itemhttps://wordpress.org/support/topic/patterns-menu-item/
-
db query on the frontendhttps://wordpress.org/support/topic/db-query-on-the-frontend/
-
Remove Gutenberg CSShttps://wordpress.org/support/topic/remove-gutenberg-css/
-
Gutenberg block CSS should be dequeued on frontendhttps://wordpress.org/support/topic/gutenberg-block-css-should-be-dequeued-on-frontend/
-
Block editor assets still enqueuedhttps://wordpress.org/support/topic/block-editor-assets-still-enqueued/
-
stop loading unnecessary fileshttps://wordpress.org/support/topic/stop-loading-unnecessary-files/
-
Feature Request: Add Option to disable the blocks in widgetshttps://wordpress.org/support/topic/feature-request-add-option-to-disable-the-blocks-in-widgets/
-
Gutenberg Block CSShttps://wordpress.org/support/topic/gutenberg-block-css/
-
Block editor resources loaded to front endhttps://wordpress.org/support/topic/block-editor-resources-loaded-to-front-end/
-
Block Library CSS still being enqueuedhttps://wordpress.org/support/topic/block-library-css-still-being-enqueued/
-
Feature Request.https://wordpress.org/support/topic/feature-request-673/
-
Classic Editor should dequeue the Gutenberg CSShttps://wordpress.org/support/topic/classic-editor-should-dequeue-the-gutenberg-css/
-
Will last this plugin?https://wordpress.org/support/topic/will-last-this-plugin/