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 in color: red.
$property_value string Required
Value in a CSS declaration, i.e. the red in color: red.

Top ↑

Return

bool


Top ↑

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 ) );
}


Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.