Skip to content

Conversation

@youknowriad
Copy link
Contributor

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.

For block themes, the Customizer CSS is merged into the global styles stylesheet before the global styles custom CSS, maintaining the intended cascade order.

This fixes two issues introduced by the Global Styles lift for classic themes:

  1. Live preview in the Customizer not working for Additional CSS changes.
  2. Additional CSS losing its cascade advantage due to being buried in the global styles stylesheet.

Props westonruter.

Trac ticket: https://core.trac.wordpress.org/ticket/64408


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props youknowriad, westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

For block themes, the Customizer CSS is merged into the global styles stylesheet before the global styles custom CSS, maintaining the intended cascade order.

This fixes two issues introduced by the Global Styles lift for classic themes:
1. Live preview in the Customizer not working for Additional CSS changes.
2. Additional CSS losing its cascade advantage due to being buried in the global styles stylesheet.

Props westonruter.
Fixes #64408.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@youknowriad youknowriad force-pushed the youknowriad/64408-rest-fields branch from 1bf4da5 to 906e0f2 Compare January 13, 2026 11:23
@westonruter
Copy link
Member

Diff with 470fcfe, the commit prior to fd2693d in which the changes were introduced:

git diff 470fcfe8d5371684eaaab87b4bc76af7811d6b74... -- src/wp-includes/script-loader.php
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 2946f19656..366f8f9366 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -2514,6 +2514,12 @@ function wp_enqueue_global_styles() {
 
 	$stylesheet = wp_get_global_stylesheet();
 
+	/*
+	 * 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>.
+	 */
 	if ( $is_block_theme ) {
 		/*
 		 * Dequeue the Customizer's custom CSS
@@ -3001,7 +3007,7 @@ function wp_maybe_inline_styles() {
 		usort(
 			$styles,
 			static function ( $a, $b ) {
-				return ( $a['size'] <= $b['size'] ) ? -1 : 1;
+				return $a['size'] <=> $b['size'];
 			}
 		);
 

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the regressions! Thank you.

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61479
GitHub commit: ac6e7c9

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants