Checks whether separate styles should be loaded for core blocks.
Description
When this function returns true, other functions ensure that core blocks use their own separate stylesheets.When this function returns false, all core blocks will use the single combined 'wp-block-library' stylesheet. As a side effect, the return value will by default result in block assets to be loaded on demand, via the wp_should_load_block_assets_on_demand() function. This behavior can be separately altered via that function. This only affects front end and not the block editor screens.
Return
bool
Whether separate core block assets will be loaded.
Hooks fired · 1
One hook fires while wp_should_load_separate_core_block_assets() runs, in this order:
Filters whether block styles should be loaded separately.
Uses · 4
is_admin()Determines whether the current request is for an administrative interface page.
is_feed()Determines whether the query is for a feed.
wp_is_rest_endpoint()Checks whether a REST API endpoint request is currently being handled.
apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 7
register_block_style_handle()Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise.
2647functionwp_should_load_separate_core_block_assets(){2648if(is_admin()||is_feed()||wp_is_rest_endpoint()){2649returnfalse;2650}26512652/**2653 * Filters whether block styles should be loaded separately.2654 *2655 * Returning false loads all core block assets, regardless of whether they are rendered2656 * in a page or not. Returning true loads core block assets only when they are rendered.2657 *2658 * @since 5.8.02659 *2660 * @param bool $load_separate_assets Whether separate assets will be loaded.2661 * Default false (all block assets are loaded, even when not used).2662 */2663returnapply_filters('should_load_separate_core_block_assets',false);2664}
History
Introduced in 5.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.