mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +00:00
Editor: Ensure global styles are loaded in the footer when loading core assets individually.
This fixes the logic in `wp_enqueue_global_styles()` to ensure that global styles are loaded in the footer when a site opts-in to loading Core block assets individually. This fixes a bug where styles defined in `themes.json` are not respected. Props walbo, nosolosw, mcsf, aristath, desrosj. Fixes #53494. git-svn-id: https://develop.svn.wordpress.org/trunk@51309 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2267,6 +2267,18 @@ function wp_enqueue_global_styles() {
|
||||
return;
|
||||
}
|
||||
|
||||
$separate_assets = wp_should_load_separate_core_block_assets();
|
||||
|
||||
/*
|
||||
* Global styles should be printed in the head when loading all styles combined.
|
||||
* The footer should only be used to print global styles for classic themes with separate core assets enabled.
|
||||
*
|
||||
* See https://core.trac.wordpress.org/ticket/53494.
|
||||
*/
|
||||
if ( ( ! $separate_assets && doing_action( 'wp_footer' ) ) || ( $separate_assets && doing_action( 'wp_enqueue_scripts' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$can_use_cache = (
|
||||
( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&
|
||||
( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) &&
|
||||
|
||||
Reference in New Issue
Block a user