should_load_separate_core_block_assets хук-фильтрWP 5.8.0

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 Введена.

Где вызывается хук

wp_should_load_separate_core_block_assets()
should_load_separate_core_block_assets
wp-includes/script-loader.php 2605
return apply_filters( 'should_load_separate_core_block_assets', false );

Где используется хук в WordPress

wp-includes/theme.php 4364
add_filter( 'should_load_separate_core_block_assets', '__return_true' );