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_name
string Required -
Property name in a CSS declaration, i.e. the
color
incolor: red
. -
$property_value
string Required -
Value in a CSS declaration, i.e. the
red
incolor: red
.
Return
bool
Source
File: wp-includes/class-wp-theme-json.php
.
View all references
protected static function is_safe_css_declaration( $property_name, $property_value ) {
$style_to_validate = $property_name . ': ' . $property_value;
$filtered = esc_html( safecss_filter_attr( $style_to_validate ) );
return ! empty( trim( $filtered ) );
}
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |