WP_Theme_JSON::is_safe_css_declaration
Checks that a declaration provided by the user is safe.
Method of the class: WP_Theme_JSON{}
No Hooks.
Returns
true|false.
Usage
$result = WP_Theme_JSON::is_safe_css_declaration( $property_name, $property_value );
- $property_name(string) (required)
- Property name in a CSS declaration, i.e. the
colorincolor: red. - $property_value(string) (required)
- Value in a CSS declaration, i.e. the
redincolor: red.
Changelog
| Since 5.9.0 | Introduced. |
WP_Theme_JSON::is_safe_css_declaration() WP Theme JSON::is safe css declaration code WP 6.9.1
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 ) );
}