mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 14:35:07 +00:00
Script Loader: Load block themes styles in the head section.
Previously, some logic was added to load the global stylesheet in the bottom of `<body>` for classic themes that opted-in into loading individual block styles instead of a single stylesheet for them all. At the time, block themes always loaded the global stylesheet in the `<head>`. When block themes landed in core during WordPress 5.9 this logic wasn’t updated to consider them, hence the global stylesheet loaded in the `<body>` for them. This changeset fixes this. Props oandregal, aristath. Fixes #55148. Built from https://develop.svn.wordpress.org/trunk@52738 git-svn-id: http://core.svn.wordpress.org/trunk@52327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ca76abd7e8
commit
8f5f8b19c5
@ -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;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52737';
|
||||
$wp_version = '6.0-alpha-52738';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user