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.
Использование
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.
По умолчанию: false (all block assets are loaded, even when not used)
Список изменений
| С версии 5.8.0 | Введена. |
Где вызывается хук
should_load_separate_core_block_assets
wp-includes/script-loader.php 2663
return apply_filters( 'should_load_separate_core_block_assets', false );
Где используется хук в 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' );