Make WordPress Core


Ignore:
Timestamp:
07/06/2021 03:16:32 PM (3 years ago)
Author:
desrosj
Message:

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, jorbin.
Merges [51309] to the 5.8 branch.
Fixes #53494.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/script-loader.php

    r51263 r51347  
    22682268    }
    22692269
     2270    $separate_assets = wp_should_load_separate_core_block_assets();
     2271
     2272    /*
     2273     * Global styles should be printed in the head when loading all styles combined.
     2274     * The footer should only be used to print global styles for classic themes with separate core assets enabled.
     2275     *
     2276     * See https://core.trac.wordpress.org/ticket/53494.
     2277     */
     2278    if ( ( ! $separate_assets && doing_action( 'wp_footer' ) ) || ( $separate_assets && doing_action( 'wp_enqueue_scripts' ) ) ) {
     2279        return;
     2280    }
     2281
    22702282    $can_use_cache = (
    22712283        ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&
Note: See TracChangeset for help on using the changeset viewer.