Skip to content

Commit 7fd4944

Browse files
committed
chore(blockEditor.php): optimize dequeueing of Gutenberg block styles
1 parent 084dabd commit 7fd4944

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

inc/blockEditor.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
* Remove Gutenberg block related styles on front-end, when a post has no blocks.
3232
*/
3333
add_action('wp_enqueue_scripts', function (): void {
34-
if (!has_blocks()) {
35-
wp_dequeue_style('core-block-supports');
36-
wp_dequeue_style('wp-block-library');
37-
wp_dequeue_style('wp-block-library-theme');
38-
wp_dequeue_style('global-styles');
34+
if (has_blocks()) {
35+
return;
3936
}
37+
38+
wp_dequeue_style('core-block-supports');
39+
wp_dequeue_style('wp-block-library');
40+
wp_dequeue_style('wp-block-library-theme');
41+
wp_dequeue_style('wp-global-styles');
42+
wp_dequeue_style('block-style-variation-styles');
4043
});

0 commit comments

Comments
 (0)