Title: WP_Theme_JSON::remove_insecure_styles
Published: February 3, 2022
Last modified: February 24, 2026

---

# WP_Theme_JSON::remove_insecure_styles( array $input ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#parameters)󠁿

 `$input`arrayrequired

Node to process.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#return)󠁿

 array

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#source)󠁿

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

    	// Ensure indirect properties not handled by `compute_style_properties` are allowed.
    	static::remove_indirect_properties( $input, $output );

    	return $output;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme-json.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-theme-json.php#L3747)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme-json.php#L3747-L3770)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#related)󠁿

| Uses | Description | 
| [_wp_array_set()](https://developer.wordpress.org/reference/functions/_wp_array_set/)`wp-includes/functions.php` |

Sets an array in depth based on a path of keys.

  | 
| [_wp_array_get()](https://developer.wordpress.org/reference/functions/_wp_array_get/)`wp-includes/functions.php` |

Accesses an array in depth based on a path of keys.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_insecure_styles/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme_json%2Fremove_insecure_styles%2F)
before being able to contribute a note or feedback.