diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index d351a502d6c20..a18cc78e2c7c7 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2307,7 +2307,9 @@ function wp_common_block_scripts_and_styles() { * @since 5.8.0 */ function wp_enqueue_global_styles() { - $separate_assets = wp_should_load_separate_core_block_assets(); + $separate_assets = wp_should_load_separate_core_block_assets(); + $is_block_theme = wp_is_block_theme(); + $is_classic_theme = ! $is_block_theme; /* * Global styles should be printed in the head when loading all styles combined. @@ -2315,7 +2317,11 @@ function wp_enqueue_global_styles() { * * See https://core.trac.wordpress.org/ticket/53494. */ - if ( ( ! $separate_assets && doing_action( 'wp_footer' ) ) || ( $separate_assets && doing_action( 'wp_enqueue_scripts' ) ) ) { + if ( + ( $is_block_theme && doing_action( 'wp_footer' ) ) || + ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) || + ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets ) + ) { return; }