W3cubDocs

/WordPress

WP_Theme_JSON::convert_custom_properties( string $value ): string

This is used to convert the internal representation of variables to the CSS representation.

Description

For example, var:preset|color|vivid-green-cyan becomes var(--wp--preset--color--vivid-green-cyan).

Parameters

$valuestringrequired
The variable such as var:preset|color|vivid-green-cyan to convert.

Return

string The converted variable.

Source

public static function remove_insecure_properties( $theme_json, $origin = 'theme' ) {
	if ( ! in_array( $origin, static::VALID_ORIGINS, true ) ) {
		$origin = 'theme';
	}

	$sanitized = array();

	$theme_json = WP_Theme_JSON_Schema::migrate( $theme_json, $origin );

	$valid_block_names   = array_keys( static::get_blocks_metadata() );
	$valid_element_names = array_keys( static::ELEMENTS );
	$valid_variations    = static::get_valid_block_style_variations();

	$theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names, $valid_variations );

	$blocks_metadata = static::get_blocks_metadata();

Changelog

Version Description
6.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/convert_custom_properties