Commit 2a51baab4b for wordpress.org

commit 2a51baab4b70ac1d4585d1d960dd9454044cb130
Author: youknowriad <youknowriad@git.wordpress.org>
Date:   Tue Jan 13 18:05:49 2026 +0000

    Customize: Preserve CSS cascade for Additional CSS in classic themes.

    Restores the `$is_block_theme` check that was inadvertently removed in [61473]. This ensures that for classic themes, the Customizer's Additional CSS continues to be printed separately via `wp_custom_css_cb()` at priority 101 in `wp_head`, preserving its position at the end of the `<head>` for highest CSS specificity.

    Follow-up to [61473].

    Props westonruter.
    Fixes #64408.

    Built from https://develop.svn.wordpress.org/trunk@61479


    git-svn-id: http://core.svn.wordpress.org/trunk@60791 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/css/dist/index.php b/wp-includes/css/dist/index.php
index a0ef32a9f7..477e76486f 100644
--- a/wp-includes/css/dist/index.php
+++ b/wp-includes/css/dist/index.php
@@ -7,11 +7,6 @@
  */

 return array(
-	array(
-		'handle' => 'wp-preferences',
-		'path' => 'preferences/style',
-		'dependencies' => array('wp-components'),
-	),
 	array(
 		'handle' => 'wp-nux',
 		'path' => 'nux/style',
@@ -22,34 +17,39 @@ return array(
 		'path' => 'list-reusable-blocks/style',
 		'dependencies' => array('wp-components'),
 	),
+	array(
+		'handle' => 'wp-preferences',
+		'path' => 'preferences/style',
+		'dependencies' => array('wp-components'),
+	),
 	array(
 		'handle' => 'wp-reusable-blocks',
 		'path' => 'reusable-blocks/style',
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
+	array(
+		'handle' => 'wp-patterns',
+		'path' => 'patterns/style',
+		'dependencies' => array('wp-block-editor', 'wp-components'),
+	),
 	array(
 		'handle' => 'wp-commands',
 		'path' => 'commands/style',
 		'dependencies' => array('wp-components'),
 	),
-	array(
-		'handle' => 'wp-widgets',
-		'path' => 'widgets/style',
-		'dependencies' => array('wp-block-editor', 'wp-components'),
-	),
 	array(
 		'handle' => 'wp-components',
 		'path' => 'components/style',
 		'dependencies' => array(),
 	),
 	array(
-		'handle' => 'wp-format-library',
-		'path' => 'format-library/style',
+		'handle' => 'wp-widgets',
+		'path' => 'widgets/style',
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
 	array(
-		'handle' => 'wp-patterns',
-		'path' => 'patterns/style',
+		'handle' => 'wp-format-library',
+		'path' => 'format-library/style',
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
 	array(
@@ -57,20 +57,15 @@ return array(
 		'path' => 'block-directory/style',
 		'dependencies' => array('wp-block-editor', 'wp-components', 'wp-editor'),
 	),
-	array(
-		'handle' => 'wp-media-utils',
-		'path' => 'media-utils/style',
-		'dependencies' => array('wp-components'),
-	),
 	array(
 		'handle' => 'wp-customize-widgets',
 		'path' => 'customize-widgets/style',
 		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-components', 'wp-media-utils', 'wp-preferences', 'wp-widgets'),
 	),
 	array(
-		'handle' => 'wp-block-library',
-		'path' => 'block-library/style',
-		'dependencies' => array('wp-block-editor', 'wp-components', 'wp-patterns'),
+		'handle' => 'wp-media-utils',
+		'path' => 'media-utils/style',
+		'dependencies' => array('wp-components'),
 	),
 	array(
 		'handle' => 'wp-edit-widgets',
@@ -82,6 +77,11 @@ return array(
 		'path' => 'edit-post/style',
 		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-preferences', 'wp-widgets'),
 	),
+	array(
+		'handle' => 'wp-block-library',
+		'path' => 'block-library/style',
+		'dependencies' => array('wp-block-editor', 'wp-components', 'wp-patterns'),
+	),
 	array(
 		'handle' => 'wp-editor',
 		'path' => 'editor/style',
diff --git a/wp-includes/js/dist/script-modules/index.php b/wp-includes/js/dist/script-modules/index.php
index c9fc8e8811..a3ef5fa9d4 100644
--- a/wp-includes/js/dist/script-modules/index.php
+++ b/wp-includes/js/dist/script-modules/index.php
@@ -7,6 +7,11 @@
  */

 return array(
+	array(
+		'id' => '@wordpress/a11y',
+		'path' => 'a11y/index',
+		'asset' => 'a11y/index.min.asset.php',
+	),
 	array(
 		'id' => '@wordpress/interactivity',
 		'path' => 'interactivity/index',
@@ -22,11 +27,6 @@ return array(
 		'path' => 'interactivity-router/full-page',
 		'asset' => 'interactivity-router/full-page.min.asset.php',
 	),
-	array(
-		'id' => '@wordpress/core-abilities',
-		'path' => 'core-abilities/index',
-		'asset' => 'core-abilities/index.min.asset.php',
-	),
 	array(
 		'id' => '@wordpress/latex-to-mathml',
 		'path' => 'latex-to-mathml/index',
@@ -37,26 +37,26 @@ return array(
 		'path' => 'latex-to-mathml/loader',
 		'asset' => 'latex-to-mathml/loader.min.asset.php',
 	),
-	array(
-		'id' => '@wordpress/a11y',
-		'path' => 'a11y/index',
-		'asset' => 'a11y/index.min.asset.php',
-	),
 	array(
 		'id' => '@wordpress/abilities',
 		'path' => 'abilities/index',
 		'asset' => 'abilities/index.min.asset.php',
 	),
 	array(
-		'id' => '@wordpress/route',
-		'path' => 'route/index',
-		'asset' => 'route/index.min.asset.php',
+		'id' => '@wordpress/core-abilities',
+		'path' => 'core-abilities/index',
+		'asset' => 'core-abilities/index.min.asset.php',
 	),
 	array(
 		'id' => '@wordpress/edit-site-init',
 		'path' => 'edit-site-init/index',
 		'asset' => 'edit-site-init/index.min.asset.php',
 	),
+	array(
+		'id' => '@wordpress/route',
+		'path' => 'route/index',
+		'asset' => 'route/index.min.asset.php',
+	),
 	array(
 		'id' => '@wordpress/lazy-editor',
 		'path' => 'lazy-editor/index',
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 8cd3301ff6..366f8f9366 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -2515,35 +2515,43 @@ function wp_enqueue_global_styles() {
 	$stylesheet = wp_get_global_stylesheet();

 	/*
-	 * Dequeue the Customizer's custom CSS
-	 * and add it before the global styles custom CSS.
+	 * For block themes, merge Customizer's custom CSS into the global styles stylesheet
+	 * before the global styles custom CSS, ensuring proper cascade order.
+	 * For classic themes, let the Customizer CSS print separately via wp_custom_css_cb()
+	 * at priority 101 in wp_head, preserving its position at the end of the <head>.
 	 */
-	remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
+	if ( $is_block_theme ) {
+		/*
+		 * Dequeue the Customizer's custom CSS
+		 * and add it before the global styles custom CSS.
+		 */
+		remove_action( 'wp_head', 'wp_custom_css_cb', 101 );

-	/*
-	 * Get the custom CSS from the Customizer and add it to the global stylesheet.
-	 * Always do this in Customizer preview for the sake of live preview since it be empty.
-	 */
-	$custom_css = trim( wp_get_custom_css() );
-	if ( $custom_css || is_customize_preview() ) {
-		if ( is_customize_preview() ) {
-			/*
-			 * When in the Customizer preview, wrap the Custom CSS in milestone comments to allow customize-preview.js
-			 * to locate the CSS to replace for live previewing. Make sure that the milestone comments are omitted from
-			 * the stored Custom CSS if by chance someone tried to add them, which would be highly unlikely, but it
-			 * would break live previewing.
-			 */
-			$before_milestone = '/*BEGIN_CUSTOMIZER_CUSTOM_CSS*/';
-			$after_milestone  = '/*END_CUSTOMIZER_CUSTOM_CSS*/';
-			$custom_css       = str_replace( array( $before_milestone, $after_milestone ), '', $custom_css );
-			$custom_css       = $before_milestone . "\n" . $custom_css . "\n" . $after_milestone;
+		/*
+		 * Get the custom CSS from the Customizer and add it to the global stylesheet.
+		 * Always do this in Customizer preview for the sake of live preview since it be empty.
+		 */
+		$custom_css = trim( wp_get_custom_css() );
+		if ( $custom_css || is_customize_preview() ) {
+			if ( is_customize_preview() ) {
+				/*
+				 * When in the Customizer preview, wrap the Custom CSS in milestone comments to allow customize-preview.js
+				 * to locate the CSS to replace for live previewing. Make sure that the milestone comments are omitted from
+				 * the stored Custom CSS if by chance someone tried to add them, which would be highly unlikely, but it
+				 * would break live previewing.
+				 */
+				$before_milestone = '/*BEGIN_CUSTOMIZER_CUSTOM_CSS*/';
+				$after_milestone  = '/*END_CUSTOMIZER_CUSTOM_CSS*/';
+				$custom_css       = str_replace( array( $before_milestone, $after_milestone ), '', $custom_css );
+				$custom_css       = $before_milestone . "\n" . $custom_css . "\n" . $after_milestone;
+			}
+			$custom_css = "\n" . $custom_css;
 		}
-		$custom_css = "\n" . $custom_css;
-	}
-	$stylesheet .= $custom_css;
+		$stylesheet .= $custom_css;

-	// Add the global styles custom CSS at the end.
-	$stylesheet .= wp_get_global_stylesheet( array( 'custom-css' ) );
+		// Add the global styles custom CSS at the end.
+		$stylesheet .= wp_get_global_stylesheet( array( 'custom-css' ) );
+	}

 	if ( empty( $stylesheet ) ) {
 		return;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 43433ac088..3d4c71ac5f 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61478';
+$wp_version = '7.0-alpha-61479';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.