WordPress: How to Remove Ununsed CSS?

Remove Gutenberg CSS

WordPress 5.0 has been moved to the new WordPress editor Gutenberg. That is the default editor for the latest WordPress installations, uses special CSS libraries to manage blocks on your site’s frontend. This means that your website will be included default CSS from Gutenberg, even you’re using Classic Editor Plugin.

Here is how to disable it:

  1. Log in to your WordPress Admin.
  2. Go to Appearance -> Theme Editor on the left menu.
  3. Find function.php (theme function file) in the Theme file listed (on the right sidebar.)
  4. Add following code to the bottom of the function file.
    add_action( 'wp_print_styles', 'wp_remove_gutenberg_styles', 100 );
    function wp_remove_gutenberg_styles() {
        wp_dequeue_style( 'wp-block-library' );
  5. Click Update File button to save the change.

That’s it.