Make WordPress Core

Opened 4 months ago

Closed 3 months ago

Last modified 5 weeks ago

#64354 closed defect (bug) (fixed)

Outlined buttons now have grey background

Reported by: pmbs's profile pmbs Owned by: westonruter's profile westonruter
Milestone: 6.9.1 Priority: high
Severity: normal Version: 6.9
Component: Script Loader Keywords: has-patch has-unit-tests has-screenshots fixed-major dev-reviewed
Focuses: css, performance Cc:

Description (last modified by westonruter)

After updating multiple websites to 6.9, all outlined buttons in the gutenberg editor now suddenly have grey background color instead of transparent background.


Issue description by @threadi from #64356:

There is a problem with the button block in the TwentyTwenty theme when using the outline style. The background color is set incorrectly.

In WP 6.8.3:

:root :where(.wp-block-button.is-style-outline--2 .wp-block-button__link) {
  background: transparent none;
}

In WP 6.9:

button, .button, .faux-button, .wp-block-button__link, .wp-block-file .wp-block-file__button, input[type=“button”], input[type=‘reset’], input[type=“submit”], .bg-accent, .bg-accent-hover:hover, .bg-accent-hover:focus, :root .has-accent-background-color, .comment-reply-link {
  background-color: #cd2653;
}

This can also be reproduced in the Playground:

  1. Go to https://playground.wordpress.net.
  2. Search for Themes > Add Theme > TwentyTwenty, install & activate.
  3. Edit Page > Sample Page
  4. Add a button block there and give it any text you like. Then select “Outline” on the right under Styles.
  5. Save and check.

Result:

  • View in the editor is correct.
  • View in the frontend is incorrect.

Possibly related support topics:

Attachments (3)

wp-error.png (26.0 KB) - added by westonruter 4 months ago.
Downloaded from https://webtron.no/wp-content/uploads/wp-error.png
64354.1.diff (433 bytes) - added by westonruter 4 months ago.
stylesheet-order-diff.png (302.5 KB) - added by westonruter 4 months ago.

Download all attachments as: .zip

Change History (54)

#1 @threadi
4 months ago

  • Keywords reporter-feedback added

hi @pmbs, welcome to Trac and thank you for your concern. It would be great if you could tell us which theme you are working with so that we can follow up on it. I myself have just opened a similar ticket for the theme TwentyTwenty (https://core.trac.wordpress.org/ticket/64356).

If you need general support, please contact the support forum: ​​​https://wordpress.org/support/forums/

#2 @swissspidy
4 months ago

#64356 was marked as a duplicate.

#3 @westonruter
4 months ago

  • Description modified (diff)

#4 @sabernhardt
4 months ago

  • Keywords reporter-feedback removed

Using Twenty Twenty, I was able to fix a Button block link with the Outline style by (temporarily) adding

add_action(
        'after_setup_theme',
        function (): void {
                add_filter( 'should_load_separate_core_block_assets', '__return_false' );
        }
);

With the assets separated, the block-style-variation-styles inline styles move from wp_footer() to wp_head(), between global styles and the classic themes stylesheet:

  1. 'wp-img-auto-sizes-contain-inline-css'
  2. when logged in: 'dashicons-css', 'admin-bar-css', and 'admin-bar-inline-css'
  3. 'wp-emoji-styles-inline-css'
  4. 'wp-block-library-inline-css' plus additional <style> elements for each active block (in my case: Archives, Button, Categories, Heading, Latest Comments, Latest Posts, Buttons, Search, and Group)
  5. 'global-styles-inline-css'
  6. 'block-style-variation-styles-inline-css', which sets a transparent background
    :root :where(.wp-block-button.is-style-outline--2 .wp-block-button__link) { background: transparent none }
  7. 'classic-theme-styles-inline-css', which sets a dark gray background
    .wp-block-button__link { background-color: #32373c }
  8. 'twentytwenty-style-css', which sets the default accent color as the background
    button, .button, .faux-button, .wp-block-button__link, .wp-block-file .wp-block-file__button, input[type="button"], input[type="reset"], input[type="submit"] { background: #cd2653 }
  9. 'twentytwenty-style-inline-css', which sets any custom accent color as the background
    button,.button,.faux-button,.wp-block-button__link,.wp-block-file .wp-block-file__button,input[type="button"],input[type="reset"],input[type="submit"],.bg-accent,.bg-accent-hover:hover,.bg-accent-hover:focus,:root .has-accent-background-color,.comment-reply-link { background-color: #d61e1e }
  10. 'twentytwenty-fonts-css'
  11. 'twentytwenty-print-style-css'

As result of the order, Twenty Twenty uses the same color for both the background and the text. The Webtron site, using a custom classic theme, likely had the gray background color from the classic themes stylesheet.

#5 @sabernhardt
4 months ago

  • Milestone changed from Awaiting Review to 6.9.1

#6 @westonruter
4 months ago

  • Component changed from General to Script Loader
  • Description modified (diff)
  • Keywords needs-patch added
  • Owner set to westonruter
  • Severity changed from major to normal
  • Status changed from new to accepted

@westonruter
4 months ago

#7 @westonruter
4 months ago

In 64354.1.diff, simply removing block-style-variation-styles from being included among the $all_block_style_handles fixes the issue for me. It ensures that the block-style-variation-styles style is printed at the end of HEAD as opposed to being inserted right after global-styles. But is this correct? In the Twenty Twenty-Five theme, the block-style-variation-styles stylesheet is inserted right after global-styles.

#8 @westonruter
4 months ago

In Twenty Twenty, when should_load_separate_core_block_assets is filtered to be false, and the post content contains:

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"className":"is-style-outline"} -->
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button">Click Here</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:image {"id":38,"sizeSlug":"large","linkDestination":"none","style":{"color":{"duotone":"var:preset|duotone|purple-yellow"}}} -->
<figure class="wp-block-image size-large"><img src="http://localhost:8000/wp-content/uploads/2025/11/Bison_bison_Wichita_Mountain_Oklahoma-1024x741.jpg" alt="" class="wp-image-38"/></figure>
<!-- /wp:image -->

<!-- wp:group {"backgroundColor":"accent","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-accent-background-color has-background"><!-- wp:paragraph -->
<p>HELLO</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

When Custom CSS is also supplied in the Customizer, the stylesheets in the document are in the following order:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > LINK#wp-block-library-css
  4. HEAD > STYLE#classic-theme-styles-inline-css
  5. HEAD > STYLE#global-styles-inline-css
  6. HEAD > LINK#twentytwenty-style-css
  7. HEAD > STYLE#twentytwenty-style-inline-css
  8. HEAD > LINK#twentytwenty-fonts-css
  9. HEAD > LINK#twentytwenty-print-style-css
  10. HEAD > STYLE#wp-custom-css
  11. BODY > STYLE#block-style-variation-styles-inline-css
  12. BODY > STYLE#core-block-supports-inline-css
  13. BODY > STYLE#core-block-supports-duotone-inline-css

At the moment, when should_load_separate_core_block_assets is enabled so that wp_hoist_late_printed_styles() is able to run, the stylesheets are in the following order:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > STYLE#wp-block-library-inline-css
  4. HEAD > STYLE#wp-block-archives-inline-css
  5. HEAD > STYLE#wp-block-button-inline-css
  6. HEAD > STYLE#wp-block-categories-inline-css
  7. HEAD > STYLE#wp-block-heading-inline-css
  8. HEAD > STYLE#wp-block-image-inline-css
  9. HEAD > STYLE#wp-block-latest-comments-inline-css
  10. HEAD > STYLE#wp-block-latest-posts-inline-css
  11. HEAD > STYLE#wp-block-buttons-inline-css
  12. HEAD > STYLE#wp-block-search-inline-css
  13. HEAD > STYLE#wp-block-group-inline-css
  14. HEAD > STYLE#wp-block-paragraph-inline-css
  15. HEAD > STYLE#global-styles-inline-css
  16. HEAD > STYLE#block-style-variation-styles-inline-css
  17. HEAD > STYLE#core-block-supports-inline-css
  18. HEAD > STYLE#core-block-supports-duotone-inline-css
  19. HEAD > STYLE#classic-theme-styles-inline-css
  20. HEAD > LINK#twentytwenty-style-css
  21. HEAD > STYLE#twentytwenty-style-inline-css
  22. HEAD > LINK#twentytwenty-fonts-css
  23. HEAD > LINK#twentytwenty-print-style-css
  24. HEAD > STYLE#wp-custom-css

With the separate block styles merged into a single LINK#wp-block-library-css entry:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > LINK#wp-block-library-css
  4. HEAD > STYLE#global-styles-inline-css
  5. HEAD > STYLE#block-style-variation-styles-inline-css
  6. HEAD > STYLE#core-block-supports-inline-css
  7. HEAD > STYLE#core-block-supports-duotone-inline-css
  8. HEAD > STYLE#classic-theme-styles-inline-css
  9. HEAD > LINK#twentytwenty-style-css
  10. HEAD > STYLE#twentytwenty-style-inline-css
  11. HEAD > LINK#twentytwenty-fonts-css
  12. HEAD > LINK#twentytwenty-print-style-css
  13. HEAD > STYLE#wp-custom-css

Here is a view of the diff between these two manifests:

https://core.trac.wordpress.org/raw-attachment/ticket/64354/stylesheet-order-diff.png

Two observations:

  1. classic-theme-styles after global-styles, whereas previously it was being printed immediately before.
  2. The block-style-variation-styles, core-block-supports, and core-block-supports-duotone styles used to be printed after the Custom CSS, but now they are being printed before.

For the first point, it seems we'll need to insert the hoisted styles after classic-theme-styles if it is present instead of only inserting after wp-block-library.

For the second point, it seems we need to not insert block-style-variation-styles, core-block-supports, and core-block-supports-duotone after wp-block-library but instead append them to the end of the HEAD, even though this is different than the order in block themes.

Note: At wp_enqueue_scripts, there is wp_common_block_scripts_and_styles() which enqueues wp-block-library but then also fires the enqueue_block_assets action. At the enqueue_block_assets action, these functions run:

  1. wp_enqueue_classic_theme_styles()
  2. wp_enqueue_registered_block_scripts_and_styles()
  3. enqueue_block_styles_assets()

JS snippet to generate the above style manifest:

copy(Array.from(document.querySelectorAll('link[rel=stylesheet][id], style[id]')).map( (el) => '1. `' + el.parentElement.tagName + ' > ' + el.tagName + '#' + el.id + '`' ).join("\n"))

This ticket was mentioned in PR #10601 on WordPress/wordpress-develop by @westonruter.


4 months ago
#9

  • Keywords has-patch has-unit-tests added; needs-patch removed

@westonruter commented on PR #10601:


4 months ago
#10

Cascade when should_load_separate_core_block_assets is disabled:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > LINK#wp-block-library-css
  4. HEAD > STYLE#classic-theme-styles-inline-css
  5. HEAD > STYLE#global-styles-inline-css
  6. HEAD > LINK#twentytwenty-style-css
  7. HEAD > STYLE#twentytwenty-style-inline-css
  8. HEAD > LINK#twentytwenty-fonts-css
  9. HEAD > LINK#twentytwenty-print-style-css
  10. HEAD > STYLE#wp-custom-css
  11. BODY > STYLE#block-style-variation-styles-inline-css
  12. BODY > STYLE#core-block-supports-inline-css
  13. BODY > STYLE#core-block-supports-duotone-inline-css

And when should_load_separate_core_block_assets is enabled:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > STYLE#wp-block-library-inline-css
  4. HEAD > STYLE#wp-block-archives-inline-css
  5. HEAD > STYLE#wp-block-button-inline-css
  6. HEAD > STYLE#wp-block-categories-inline-css
  7. HEAD > STYLE#wp-block-heading-inline-css
  8. HEAD > STYLE#wp-block-image-inline-css
  9. HEAD > STYLE#wp-block-latest-comments-inline-css
  10. HEAD > STYLE#wp-block-latest-posts-inline-css
  11. HEAD > STYLE#wp-block-buttons-inline-css
  12. HEAD > STYLE#wp-block-search-inline-css
  13. HEAD > STYLE#wp-block-group-inline-css
  14. HEAD > STYLE#wp-block-paragraph-inline-css
  15. HEAD > STYLE#classic-theme-styles-inline-css
  16. HEAD > STYLE#global-styles-inline-css
  17. HEAD > LINK#twentytwenty-style-css
  18. HEAD > STYLE#twentytwenty-style-inline-css
  19. HEAD > LINK#twentytwenty-fonts-css
  20. HEAD > LINK#twentytwenty-print-style-css
  21. HEAD > STYLE#wp-custom-css
  22. HEAD > STYLE#block-style-variation-styles-inline-css
  23. HEAD > STYLE#core-block-supports-inline-css
  24. HEAD > STYLE#core-block-supports-duotone-inline-css

When the block styles are grouped under the related HEAD > LINK#wp-block-library-css entry, the order is:

  1. HEAD > STYLE#wp-img-auto-sizes-contain-inline-css
  2. HEAD > STYLE#wp-emoji-styles-inline-css
  3. HEAD > LINK#wp-block-library-css
  4. HEAD > STYLE#classic-theme-styles-inline-css
  5. HEAD > STYLE#global-styles-inline-css
  6. HEAD > LINK#twentytwenty-style-css
  7. HEAD > STYLE#twentytwenty-style-inline-css
  8. HEAD > LINK#twentytwenty-fonts-css
  9. HEAD > LINK#twentytwenty-print-style-css
  10. HEAD > STYLE#wp-custom-css
  11. HEAD > STYLE#block-style-variation-styles-inline-css
  12. HEAD > STYLE#core-block-supports-inline-css
  13. HEAD > STYLE#core-block-supports-duotone-inline-css

The cascade is the same, with the difference being that block-style-variation-styles, core-block-supports, and core-block-supports-duotone are located in HEAD as opposed to BODY. This is good as it prevents FOUC.

#11 @westonruter
4 months ago

  • Keywords needs-testing added

Here's my first stab at preserving the original cascade: https://github.com/WordPress/wordpress-develop/pull/10601

#12 @westonruter
4 months ago

There's one more thing I'm aware of that needs to investigated: the enqueue_block_assets action will, as mentioned above, call these functions:

  1. wp_enqueue_classic_theme_styles()
  2. wp_enqueue_registered_block_scripts_and_styles()
  3. enqueue_block_styles_assets()

The first function is accounted for in this PR, as it actually already ran at wp_enqueue_scripts. The second function is also accounted for, because it short-circuits if wp_should_load_block_assets_on_demand() returns false (in which case the style hoisting doesn't happen at all anyway).

However, the third function I believe needs to be accounted for. Namely, any styles for third-party blocks being used on the page would seem to need to be printed after the classic-theme-styles stylesheet, whereas the other core block styles get printed before. This would ensure the cascade is remains the same.

#13 @madhavishah01
4 months ago

I was able to reproduce the issue in Twenty Twenty and the outline button shows a filled background. After applying the patch, the outline style displays correctly again. The problem disappears with the patch, so it is working as expected. I have before and after screenshots to confirm the change.

Kindly refer below image before applying patch:-
https://prnt.sc/tJZQbsVSXSzS

Kindly refer below image after applying patch:-
https://prnt.sc/cYrHz85I3yu-

Last edited 4 months ago by westonruter (previous) (diff)

#14 @westonruter
4 months ago

As a workaround for sites experiencing this issue, I've just published a small single-file plugin that allows you to remain on 6.9 but opt out of loading separate core block styles. Naturally, the plugin is called Load Combined Core Block Assets. This plugin includes the ability for you to test loading separate core block styles via a query parameter. Once 6.9.1 is released with the fix, the plugin could inform you to re-test, so that the plugin can be deactivated and uninstalled at that time.

If you added the following to your site via a theme or plugin:

<?php
add_filter( 'should_load_separate_core_block_assets', '__return_false' );

Please remove this, and instead install the plugin. This will help ensure you don't get stuck with loading the combined core block assets indefinitely. The use of combined core block assets means much more CSS is added to the page than is likely needed, and this can negatively impact page load time (e.g. FCP and LCP). By WordPress 6.9 loading separate block assets on demand, this also allows for small stylesheets to be inlined to further reduce render-blocking resources.

Last edited 4 months ago by westonruter (previous) (diff)

#15 @westonruter
4 months ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core-performance by westonruter. View the logs.


4 months ago

#17 @westonruter
4 months ago

  • Focuses performance added

#18 @sabernhardt
4 months ago

The PR fixed the links' background visually in the themes I tested, with block stylesheets separate and inlined.

In WordPress 6.9, without setting a background color in the sidebar, Outline Button block links have

  • a background that matches the text color in four bundled themes (T11, T14, T15, and T20) plus the directory theme Sydney;
  • the gray background from classic-themes.min.css for Twenty Ten plus directory themes such as Neve, Franklin, Make, and Ravel;
  • the (correct) transparent background in other classic bundled themes because the theme's CSS sets the background at a specificity higher than one class (T12 and T13 use inherit in blocks.css, T16 and T17 use transparent in blocks.css, and T19 and T21 use transparent in style.css).

With PR 10601:

  • T10, T11, T14, T15, T20, Sydney, OceanWP, Neve, Franklin, Make, and Ravel now get transparent background from block-style-variation-styles-inline-css.
  • T12, T13, T16, T17, T19, T21, Astra, Colibri WP (with Modern option), Kadence, and Storefront continue to show the transparent background from the theme's CSS.

@peterwilsoncc commented on PR #10601:


4 months ago
#19

@westonruter When it comes to writing tests, are you able to include some for non-core block variations too.

@westonruter commented on PR #10601:


4 months ago
#20

@peterwilsoncc you mean like in 2fb1c42?

@westonruter commented on PR #10601:


4 months ago
#21

I'm currently wrestling with some styles not being in a consistent order in unit tests.

@westonruter commented on PR #10601:


4 months ago
#22

OK, I've finally wrestled this into submission. Ready for more testing and review. Ensuring the same cascade when hoisting loading separate block styles is trickt!

#23 @raftaar1191
4 months ago

Test Report

Description

✅ This report validates whether the indicated patch works as expected.

Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/10601.diff

Environment

  • WordPress: 6.9
  • PHP: 8.3.25-dev
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 5.5 / Client: 3.40.1)
  • Browser: Chrome 142.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty 3.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.

Additional Notes

Screenshot Before: https://ibb.co/hJ8WwBn3
Screenshot After: https://ibb.co/wZch4Zjk

#24 @noruzzaman
4 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/10601

Environment

  • WordPress: 7.0-alpha-61215-src
  • PHP: 8.2.29
  • Server: nginx/1.29.3
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 143.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty 2.9
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.

Screenshots

Before After
https://i.ibb.co/QF9GWW4n/beforefrontendpatch.png https://i.ibb.co/rGJp4ZqJ/frontendview.png

This ticket was mentioned in Slack in #core-editor by westonruter. View the logs.


3 months ago

#26 @ozgursar
3 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/10601

Environment

  • WordPress: 7.0-alpha-20260112.064841
  • PHP: 8.3.29
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Opera
  • OS: macOS
  • Theme: Twenty Twenty 3.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.

Screenshots

Before After
https://i.snipboard.io/K50c6b.jpg https://i.snipboard.io/O6vGuW.jpg

@westonruter commented on PR #10601:


3 months ago
#27

The merge conflict is due to https://github.com/WordPress/wordpress-develop/commit/fd2693d97125ab763f159770eb897adec3037906 which may need to be reverted, so I'm not resolving the merge conflict just yet. See Trac comment.

#28 @SirLouen
3 months ago

  • Keywords has-screenshots added; needs-testing removed

#29 @westonruter
3 months ago

  • Keywords dev-feedback added

This ticket was mentioned in Slack in #core-performance by westonruter. View the logs.


3 months ago

This ticket was mentioned in Slack in #core by jorbin. View the logs.


3 months ago

This ticket was mentioned in Slack in #core-editor by westonruter. View the logs.


3 months ago

This ticket was mentioned in Slack in #core by jorbin. View the logs.


3 months ago

#34 @audrasjb
3 months ago

The logic of the proposed PR looks relevant to me.
The issue is also resolved on my side. I tested the patch on a fresh installation of WP 6.9 with Twenty Twenty and also in production on a personal website that uses T20 with a custom child theme overriding some styles.

This ticket was mentioned in Slack in #core by wildworks. View the logs.


3 months ago

#36 @wildworks
3 months ago

This ticket was featured in today's 6.9.1 Bug SCrub.

6.9.1 RC is approaching, but from what I can see, the code changes are quite complex and require more time for review. What do you all think?

Fortunately, there is also the Load Combined Core Block Assets plugin available to fix this issue.

#37 @westonruter
3 months ago

I won't pretend that this is easy to review.

I'm concerned about the fix waiting longer than 6.9.1, however, because the longer sites have a different CSS cascade then the more likely that this fix will end up breaking new sites built specifically on 6.9 when the CSS cascade is reverted to the original order.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


3 months ago

#39 @jorbin
3 months ago

  • Priority changed from normal to high

I agree with @westonruter that this should absolutely make it in 6.9.1 as long as we can get confident in it. I am bumping the priority as such.

#40 @wildworks
3 months ago

I’m trying to understand https://github.com/WordPress/wordpress-develop/pull/10601, but to be honest it’s a bit beyond my understanding, so it’s hard for me to review the code :) I’d appreciate it if someone could help take a look.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


3 months ago

#42 @audrasjb
3 months ago

I wouldn't say that I deeply understand each bit of the PR, but the overall logic looks good and we have at least 4 tests that validated it fixes the exact issue mentioned in this ticket.
On my side, the remaining question is: before shipping this, should we have broader tests on various other themes to try to anticipate any edge case?
Otherwise, I think we're good to go with this patch.

@westonruter commented on PR #10601:


3 months ago
#43

Excellent. I'll commit in the morning (~14 hours from now).

#44 @westonruter
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 61554:

Script Loader: Preserve original CSS cascade for classic themes when hoisting late-printed styles.

This refactors wp_hoist_late_printed_styles() to strictly preserve the classic theme CSS cascade when moving styles from wp_footer to the HEAD. Previously, hoisted styles were appended in an order closer to the CSS cascade for block themes, potentially causing specificity issues for CSS selectors written for the previous cascade. This is intended to eliminate the need for sites which upgraded to 6.9 to apply a hotfix involving add_filter( 'should_load_separate_core_block_assets', '__return_false' ) to disable the optimization.

Key changes:

  • Identifies styles enqueued during enqueue_block_assets.
  • Separates core block styles from third-party block styles.
  • Inserts core block styles immediately after wp-block-library.
  • Inserts third-party block styles after classic-theme-styles.
  • Inserts global-styles after all enqueue_block_assets styles.

This ensures the following order is maintained:

  1. Core block library.
  2. Core block styles.
  3. Classic theme styles.
  4. Third-party block styles.
  5. Global styles.

Developed in https://github.com/WordPress/wordpress-develop/pull/10601

Follow-up to [61174], [61122], [61076], [61008].

Props westonruter, wildworks, jorbin, peterwilsoncc, sabernhardt, audrasjb, pmbs, threadi, madhavishah01, raftaar1191, noruzzaman, ozgursar.
See #64099, #64150, #43258.
Fixes #64354.

#45 @westonruter
3 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for 6.9.1 backport.

#47 @jorbin
3 months ago

  • Keywords dev-reviewed added; dev-feedback removed

[61554] looks good for backport to the 6.9 branch.

Backport tested in https://github.com/WordPress/wordpress-develop/pull/10819 and only seeing flaky tests being flaky.

#48 @jorbin
3 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 61556:

Script Loader: Preserve original CSS cascade for classic themes when hoisting late-printed styles.

This refactors wp_hoist_late_printed_styles() to strictly preserve the classic theme CSS cascade when moving styles from wp_footer to the HEAD. Previously, hoisted styles were appended in an order closer to the CSS cascade for block themes, potentially causing specificity issues for CSS selectors written for the previous cascade. This is intended to eliminate the need for sites which upgraded to 6.9 to apply a hotfix involving add_filter( 'should_load_separate_core_block_assets', '__return_false' ) to disable the optimization.

Key changes:

  • Identifies styles enqueued during enqueue_block_assets.
  • Separates core block styles from third-party block styles.
  • Inserts core block styles immediately after wp-block-library.
  • Inserts third-party block styles after classic-theme-styles.
  • Inserts global-styles after all enqueue_block_assets styles.

This ensures the following order is maintained:

  1. Core block library.
  2. Core block styles.
  3. Classic theme styles.
  4. Third-party block styles.
  5. Global styles.

Developed in https://github.com/WordPress/wordpress-develop/pull/10601

Follow-up to [61174], [61122], [61076], [61008].

Reviewed by jorbin.
Merges [61554] to the 6.9 branch.

Props westonruter, wildworks, jorbin, peterwilsoncc, sabernhardt, audrasjb, pmbs, threadi, madhavishah01, raftaar1191, noruzzaman, ozgursar.
See #64099, #64150, #43258.
Fixes #64354.

#49 @tlgtimeshare
2 months ago

I tried creating a new thread but it keeps saying "Error: Submission rejected as potential spam" Akismet says content is spam
Maximum number of posts per hour for this IP exceeded
Even though this is my first post. I am having to add a comment here. Feel free to move to new thread if possible.

A number of us still have issues with "loading separate core block styles" and are having to use the Load Combined Core Block Assets plugin https://wordpress.org/plugins/load-combined-core-block-assets/ as a workaround.

We first raised the thread in Yoast SEO support as it was the plugin that triggered it for the majority of us https://github.com/Yoast/wordpress-seo/issues/22788#issuecomment-3637120521

It was assumed based on the feedback that the issue would be addressed in 6.9.1 but after 2 months the issue remains in 6.9.1 and we're still looking for a permanent fix. At a loss what to do to resolve this without the plugin above. Thanks.

#50 @westonruter
2 months ago

@tlgtimeshare please see #64389 for follow-up. Testing appreciated.

#51 @westonruter
5 weeks ago

In 61945:

Script Loader: Refine hoisted stylesheet ordering to preserve original CSS cascade in classic themes.

This introduces placeholder inline STYLE tags in the HEAD which are used to accurately locate hoisted styles which were printed in the footer. This improves the robustness of the hoisting logic. A style placeholder had been used previously in the inline style for wp-block-library for placing core block styles, and new placeholders are added for global styles and non-core block styles.

Furthermore, this fixes the cascade for inline styles added to wp-block-library. When separate block styles are not used, these styles would have appeared after the single combined wp-block-library. However, in 6.9 the order changed so that separate block styles would appear after. To preserve the original cascade, this splits the wp-block-library inline style: the first half (likely just the inlined block-library/common.css) appears before the block styles, and the remainder appears in a new STYLE#wp-block-library-inline-css-extra element.

Developed in https://github.com/WordPress/wordpress-develop/pull/10875

Follow-up to r61554, r61174, r61122, r61076, r61008.

Props westonruter, joefusco, adamsilverstein, ocean90, mmorris8, ozgursar, vanonsopensource, xwolf, immeet94, george9, joezappie, jorbin, sajib1223, sabernhardt.
See #64099, #64354, #64150, #43258.
Fixes #64389.

Note: See TracTickets for help on using tickets.