WP_Theme_JSON::is_safe_css_declaration() – Checks that a declaration provided by the user is safe.

You appear to be a bot. Output may be restricted

Description

Checks that a declaration provided by the user is safe.

Usage

$bool = WP_Theme_JSON::is_safe_css_declaration( $property_name, $property_value );

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`.

Returns

bool

Source

File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:

1 to 5 of 5
  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 ) );
  }
 

 View on GitHub View on Trac