[wp-trac] [WordPress Trac] #64099: Load block styles on demand in classic themes via template enhancement output buffer

WordPress Trac noreply at wordpress.org
Thu Mar 12 05:44:38 UTC 2026


#64099: Load block styles on demand in classic themes via template enhancement
output buffer
-------------------------------------------------+-------------------------
 Reporter:  westonruter                          |       Owner:
                                                 |  westonruter
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.9
Component:  Script Loader                        |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-dev-    |     Focuses:
  note                                           |  performance
-------------------------------------------------+-------------------------

Comment (by westonruter):

 In [changeset:"61981" 61981]:
 {{{
 #!CommitTicketReference repository="" revision="61981"
 Script Loader: Move `wp_load_classic_theme_block_styles_on_demand()` from
 `init` to `wp_default_styles`.

 This ensures the filters to opt in to loading separate block styles on
 demand are added at the moment `WP_Styles` is constructed. This accounts
 for styles being registered at the `init` action before
 `register_core_block_style_handles()` runs at priority 9. Without this,
 the `wp-block-library` stylesheet may get registered with the full
 combined block styles as `style.css` instead of just `common.css`, due to
 `wp_should_load_block_assets_on_demand()` still returning false. The
 `wp_default_styles` action still runs during `init`.

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

 Follow-up to r61008.

 Props westonruter, adamsilverstein.
 See #64099.
 Fixes #64846.
 }}}

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


More information about the wp-trac mailing list