[wp-trac] [WordPress Trac] #64846: Loading separate styles on demand thwarted by plugins that register styles at 'init' with priority less than 8

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


#64846: Loading separate styles on demand thwarted by plugins that register styles
at 'init' with priority less than 8
-------------------------------------------------+-------------------------
 Reporter:  westonruter                          |       Owner:
                                                 |  westonruter
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  7.0
Component:  Script Loader                        |     Version:  6.9
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:  css,
  testing                                        |  performance
-------------------------------------------------+-------------------------
Changes (by westonruter):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 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/64846#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list