WP_Theme_JSON::remove_insecure_styles()protected staticWP 5.9.0

Processes a style node and returns the same node without the insecure styles.

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

Array.

Usage

$result = WP_Theme_JSON::remove_insecure_styles( $input );
$input(array) (required)
Node to process.

Changelog

Since 5.9.0 Introduced.

Code of WP_Theme_JSON::remove_insecure_styles() WP 6.0

protected static function remove_insecure_styles( $input ) {
	$output       = array();
	$declarations = static::compute_style_properties( $input );

	foreach ( $declarations as $declaration ) {
		if ( static::is_safe_css_declaration( $declaration['name'], $declaration['value'] ) ) {
			$path = static::PROPERTIES_METADATA[ $declaration['name'] ];

			// Check the value isn't an array before adding so as to not
			// double up shorthand and longhand styles.
			$value = _wp_array_get( $input, $path, array() );
			if ( ! is_array( $value ) ) {
				_wp_array_set( $output, $path, $value );
			}
		}
	}
	return $output;
}