wp enqueue script – Dequeue Gutenburg Block Library CSS (‘wp-block-library’) in Admin


I am working on removing the default Gutenberg block library stylesheet and replacing it with custom pared-down styles. I do not want the original stylesheet to load on either the front or back end, as it means I’d need to add unnecessary bulk to the custom styles in order to override styles in the default stylesheet.

I’ve successfully dequeued the styles from the front end using the standard in a wp_enqueue_scripts action:

function test_function(){
add_action( 'wp_enqueue_scripts', 'test_function' );

However, this does not dequeue the styles from the block editor. I have tried dequeuing from an admin_init action as well, and that also does not remove the styles from the block editor.

Is it possible to dequeue this stylesheet from both the front-end and the admin block editor?

in progress 0
StudioAl 2 weeks 2021-05-27T18:59:07-05:00 0 Answer 0 views 0

Answer ( 1 )


    I find a solution: Using


    (instead of wp_dequeue_style('wp-block-library')) works for the block editor. It worked in either an admin_init or an admin_enqueue_scripts action.

Leave an answer