W3cubDocs

/WordPress

WP_Theme_JSON::is_safe_css_declaration( string $property_name, string $property_value ): bool

Checks that a declaration provided by the user is safe.

Parameters

$property_namestringrequired
Property name in a CSS declaration, i.e. the color in color: red.
$property_valuestringrequired
Value in a CSS declaration, i.e. the red in color: red.

Return

bool

Source

$content_size = static::is_safe_css_declaration( 'max-width', $content_size ) ? $content_size : 'initial';
$wide_size    = isset( $settings['layout']['wideSize'] ) ? $settings['layout']['wideSize'] : $settings['layout']['contentSize'];
$wide_size    = static::is_safe_css_declaration( 'max-width', $wide_size ) ? $wide_size : 'initial';
$css         .= static::ROOT_CSS_PROPERTIES_SELECTOR . ' { --wp--style--global--content-size: ' . $content_size . ';';
$css         .= '--wp--style--global--wide-size: ' . $wide_size . '; }';

Changelog

Version Description
5.9.0 Introduced.

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