W3cubDocs

/WordPress

WP_Theme_JSON::resolve_custom_css_format( array $tree ): array

Given a tree, converts the internal representation of variables to the CSS representation.

Description

It is recursive and modifies the input in-place.

Parameters

$treearrayrequired
Input to process.

Return

array The modified $tree.

Source

// The global styles custom CSS is not sanitized, but can only be edited by users with 'edit_css' capability.
if ( isset( $input['css'] ) && current_user_can( 'edit_css' ) ) {
	$output = $input;
} else {
	$output = static::remove_insecure_styles( $input );
}

/*
 * Get a reference to element name from path.
 * $metadata['path'] = array( 'styles', 'elements', 'link' );
 */
$current_element = $metadata['path'][ count( $metadata['path'] ) - 1 ];

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/resolve_custom_css_format