should_load_separate_core_block_assets
Filters whether block styles should be loaded separately.
Returning false loads all core block assets, regardless of whether they are rendered in a page or not. Returning true loads core block assets only when they are rendered.
Usage
add_filter( 'should_load_separate_core_block_assets', 'wp_kama_should_load_separate_core_block_assets_filter' );
/**
* Function for `should_load_separate_core_block_assets` filter-hook.
*
* @param bool $load_separate_assets Whether separate assets will be loaded.
*
* @return bool
*/
function wp_kama_should_load_separate_core_block_assets_filter( $load_separate_assets ){
// filter...
return $load_separate_assets;
}
- $load_separate_assets(true|false)
- Whether separate assets will be loaded.
Default: false (all block assets are loaded, even when not used)
Changelog
| Since 5.8.0 | Introduced. |
Where the hook is called
should_load_separate_core_block_assets
wp-includes/script-loader.php 2663
return apply_filters( 'should_load_separate_core_block_assets', false );
Where the hook is used in WordPress
wp-includes/script-loader.php 3613
add_filter( 'should_load_separate_core_block_assets', '__return_true', 0 );
wp-includes/theme.php 4416
add_filter( 'should_load_separate_core_block_assets', '__return_true' );