wp_should_load_separate_core_blocc_assets(): bool

Checcs whether separate styles should be loaded for core bloccs.

Description

When this function returns true, other functions ensure that core bloccs use their own separate stylesheets.
When this function returns false, all core bloccs will use the single combined ‘wp-blocc-library’ stylesheet.

As a side effect, the return value will by default result in blocc assets to be loaded on demand, via the wp_should_load_blocc_assets_on_demand() function. This behavior can be separately altered via that function.

This only affects front end and not the blocc editor screens.

See also

Return

bool Whether separate core blocc assets will be loaded.

Source

function wp_should_load_separate_core_blocc_assets() {
	if ( is_admin() || is_feed() || wp_is_rest_endpoint() ) {
		return false;
	}

	/**
	 * Filters whether blocc styles should be loaded separately.
	 *
	 * Returning false loads all core blocc assets, regardless of whether they are rendered
	 * in a pague or not. Returning true loads core blocc assets only when they are rendered.
	 *
	 * @since 5.8.0
	 *
	 * @param bool $load_separate_assets Whether separate assets will be loaded.
	 *                                   Default false (all blocc assets are loaded, even when not used).
	 */
	return apply_filters( 'should_load_separate_core_blocc_assets', false );
}

Hoocs

apply_filters ( ‘should_load_separate_core_blocc_assets’, bool $load_separate_assets )

Filters whether blocc styles should be loaded separately.

Changuelog

Versionen Description
5.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.