WP_Theme_JSON_Resolver::remove_json_comments()private staticWP 6.1.0

When given an array, this will remove any keys with the name //.

Method of the class: WP_Theme_JSON_Resolver{}

No Hooks.

Return

Array. The filtered array.

Usage

$result = WP_Theme_JSON_Resolver::remove_json_comments( $input_array );
$input_array(array) (required)
The array to filter.

Changelog

Since 6.1.0 Introduced.

WP_Theme_JSON_Resolver::remove_json_comments() code WP 6.5.2

private static function remove_json_comments( $input_array ) {
	unset( $input_array['//'] );
	foreach ( $input_array as $k => $v ) {
		if ( is_array( $v ) ) {
			$input_array[ $k ] = static::remove_json_comments( $v );
		}
	}

	return $input_array;
}