Make WordPress Core


Ignore:
Timestamp:
03/12/2026 05:44:22 AM (3 months ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/template.php

    r61945 r61981  
    19641964        self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
    19651965
     1966        if ( $set_up ) {
     1967            $set_up();
     1968        }
     1969
    19661970        switch_theme( 'default' );
    19671971        global $wp_styles;
     
    20012005            }
    20022006        );
    2003 
    2004         if ( $set_up ) {
    2005             $set_up();
    2006         }
    20072007
    20082008        wp_load_classic_theme_block_styles_on_demand();
Note: See TracChangeset for help on using the changeset viewer.