Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active January 16, 2019 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wplit/1077a90bd9492b245f12c42f00e2ab0b to your computer and use it in GitHub Desktop.
Save wplit/1077a90bd9492b245f12c42f00e2ab0b to your computer and use it in GitHub Desktop.
Conditionally remove WP block editor (gutenberg) library CSS from front
add_action( 'wp_print_styles', 'lit_deregister_editor_styles', 100 );
/**
* Removes WP block editor styles
*/
function lit_deregister_editor_styles() {
if ( !is_singular('post') ) { // If isn't a single post, remove excess block libary CSS
wp_dequeue_style( 'wp-block-library' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment