diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index d5ae209904982..f3014a241f336 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2408,12 +2408,13 @@ function wp_enqueue_global_styles() { return; } - /** - * If we are loading CSS for each block separately, then we can load the theme.json CSS conditionally. + /* + * If loading the CSS for each block separately, then load the theme.json CSS conditionally. * This removes the CSS from the global-styles stylesheet and adds it to the inline CSS for each block. - * This filter has to be registered before we call wp_get_global_stylesheet(); + * This filter must be registered before calling wp_get_global_stylesheet(); */ add_filter( 'theme_json_get_style_nodes', 'wp_filter_out_block_nodes' ); + $stylesheet = wp_get_global_stylesheet(); if ( empty( $stylesheet ) ) { @@ -2424,7 +2425,7 @@ function wp_enqueue_global_styles() { wp_add_inline_style( 'global-styles', $stylesheet ); wp_enqueue_style( 'global-styles' ); - // add each block as an inline css. + // Add each block as an inline css. wp_add_global_styles_for_blocks(); }