Remove WordPress block CSS
Updated: 2022-10-12 with extra stuff to be removed.
Updated: 2023-01-29 with extra stuff to be removed.
Sometimes you want to disable the WordPress block editor CSS. Needlessly downloading an extra file is just slowing your site down. The following code neatly strips it from your site. Simply include it in your theme or plugin to disable the CSS from being loaded.
<?php /** * Disable WordPress block editor CSS. */ function disable_gutenberg_junk() { wp_dequeue_style( 'wp-block-library' ); wp_dequeue_style( 'wp-block-library-theme' ); wp_dequeue_style( 'global-styles' ); wp_dequeue_style( 'wc-block-style' ); wp_dequeue_style( 'classic-theme-styles' ); } add_action( 'wp_print_styles', 'disable_gutenberg_junk', 100 );