Is it possible to un-enqueue stylesheets for the built-in Gutenberg block types?
e.g. I would like to add custom styles for the Gutenberg Columns block, so I'd like to un-enqueue the stylesheets just for this block type, but keep the default styles for the others.
Is it possible to un-enqueue stylesheets for the built-in Gutenberg block types?
e.g. I would like to add custom styles for the Gutenberg Columns block, so I'd like to un-enqueue the stylesheets just for this block type, but keep the default styles for the others.
Share Improve this question asked Jan 15, 2019 at 11:44 benedict_wbenedict_w 5912 gold badges7 silver badges17 bronze badges1 Answer
Reset to default 1In Gutenberg and plugins for Gutenberg are all styles involved via wp_enqueue_style
. I would to see all developers use wp_register_style
before, makes easier to deregister. However you should un-enqueue the style via the core function wp_dequeue_style
.
So this should work, in dependency of the hook and handle of the style and his handle, here for example gutenberg-handle-foo
.
add_action('wp_print_styles', function() {
wp_dequeue_style('gutenberg-handle-foo');
}, 99);
A screenshot
about handle examaples in the WP Admin Edit Post screen, version 5.2 of WP.