Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_Duotone::enqueue_global_styles_preset( string $filter_id, string $duotone_selector, string $filter_value )

Enqueue preset assets for the page.


Includes a CSS custom property, SVG filter, and block CSS declaration.

Top ↑


$filter_id string Required
The filter ID. e.g. 'wp-duotone-blue-orange'.
$duotone_selector string Required
The block's duotone selector. e.g. '.wp-block-image img'.
$filter_value string Required
The filter CSS value. e.g. 'url(#wp-duotone-blue-orange)' or 'unset'.

Top ↑


File: wp-includes/class-wp-duotone.php. View all references

private static function enqueue_global_styles_preset( $filter_id, $duotone_selector, $filter_value ) {
	$global_styles_presets = self::get_all_global_styles_presets();
	if ( ! array_key_exists( $filter_id, $global_styles_presets ) ) {
		$error_message = sprintf(
			/* translators: %s: duotone filter ID */
			__( 'The duotone id "%s" is not registered in theme.json settings' ),
		_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
	self::$used_global_styles_presets[ $filter_id ] = $global_styles_presets[ $filter_id ];
	self::enqueue_custom_filter( $filter_id, $duotone_selector, $filter_value, $global_styles_presets[ $filter_id ] );

Top ↑


Version Description
6.3.0 Introduced.

Top ↑

User Contributed Notes

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