On this page
WP_Theme_JSON::remove_insecure_styles( array $input ): array
Processes a style node and returns the same node without the insecure styles.
Parameters
$inputarray Required-
Node to process.
Return
array
Source
File: wp-includes/class-wp-theme-json.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| _wp_array_set() wp-includes/functions.php | Sets an array in depth based on a path of keys. |
| _wp_array_get() wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles