wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_should_load_block_assets_on_demand › WordPress Function

Since6.8.0
Deprecatedn/a
wp_should_load_block_assets_on_demand ( No parameters )
See:
Returns:
  • (bool) Whether to load block assets only when they are rendered.
Defined at:
Codex:

Checks whether block styles should be loaded only on-render.

When this function returns true, other functions ensure that blocks only load their assets on-render. When this function returns false, all block assets are loaded regardless of whether they are rendered in a page. The default return value depends on the result of {@see}, which controls whether Core block stylesheets should be loaded separately or via a combined 'wp-block-library' stylesheet. This only affects front end and not the block editor screens.


Source

*/
	$load_assets_on_demand = wp_should_load_separate_core_block_assets();

	/**
	 * Filters whether block styles should be loaded on demand.
	 *
	 * Returning false loads all block assets, regardless of whether they are rendered in a page or not.
	 * Returning true loads block assets only when they are rendered.
	 *
	 * The default value of the filter depends on the result of {@see wp_should_load_separate_core_block_assets()},
	 * which controls whether Core block stylesheets should be loaded separately or via a combined 'wp-block-library'
	 * stylesheet.
	 *
	 * @since 6.8.0
	 *
	 * @param bool $load_assets_on_demand Whether to load block assets only when they are rendered.
	 */
	return apply_filters( 'should_load_block_assets_on_demand', $load_assets_on_demand );
}