[wp-trac] [WordPress Trac] #64150: Late-printed styles are not hoisted to HEAD if wp-block-library is not enqueued

WordPress Trac noreply at wordpress.org
Tue Nov 4 07:53:41 UTC 2025


#64150: Late-printed styles are not hoisted to HEAD if wp-block-library is not
enqueued
--------------------------------------+--------------------------
 Reporter:  westonruter               |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.9
Component:  Script Loader             |     Version:  trunk
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------------

Comment (by westonruter):

 In [changeset:"61122" 61122]:
 {{{
 #!CommitTicketReference repository="" revision="61122"
 Script Loader: Load block styles on demand in classic themes even when
 `wp-block-styles` support is absent.

 This reverts part of [61076] which made `wp-block-styles` theme support a
 precondition for opting in to `should_load_separate_core_block_assets` and
 `should_load_block_assets_on_demand`. This meant that the Twenty Twenty
 theme (and other themes without this support declared) would not benefit
 from on-demand block style loading. Nevertheless, even though such themes
 were not getting block styles loaded on demand, the
 `wp_load_classic_theme_block_styles_on_demand()` function was proceeding
 to opt in to the output buffer for hoisting late-printed styles, even
 though it was unlikely there would then be any. This meant the template
 enhancement output buffer was being opened for no reason.

 Enabling on-demand block style loading is measured to improve FCP and LCP
 in Twenty Twenty, for example a ~13% improvement over a Fast 4G connection
 when loading the Sample Page.

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

 Follow-up to [61008], [61076], [60936].

 Props westonruter.
 See #64099, #64150, #64166, #43258.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64150#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list