Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_Theme_JSON_Resolver::remove_json_comments( array $array ): array

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


$array array Required
The array to filter.

Top ↑


array The filtered array.

Top ↑


File: wp-includes/class-wp-theme-json-resolver.php. View all references

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

	return $array;

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.