WP_Theme_JSON::remove_insecure_element_styles()
Remove insecure element styles within a variation or block.
Method of the class: WP_Theme_JSON{}
No Hooks.
Return
Array
. The sanitized elements styles.
Usage
$result = WP_Theme_JSON::remove_insecure_element_styles( $elements );
- $elements(array) (required)
- The elements to process.
Changelog
Since 6.8.0 | Introduced. |
WP_Theme_JSON::remove_insecure_element_styles() WP Theme JSON::remove insecure element styles code WP 6.8
protected static function remove_insecure_element_styles( $elements ) { $sanitized = array(); $valid_element_names = array_keys( static::ELEMENTS ); foreach ( $valid_element_names as $element_name ) { $element_input = $elements[ $element_name ] ?? null; if ( $element_input ) { $element_output = static::remove_insecure_styles( $element_input ); if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) { foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) { if ( isset( $element_input[ $pseudo_selector ] ) ) { $element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] ); } } } $sanitized[ $element_name ] = $element_output; } } return $sanitized; }