WP_Theme_JSON_Resolver::recursively_iterate_json( string $dir ): array

In this article

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.

Returns an array of all nested JSON files within a given directory.

Parameters

$dirstringrequired
The directory to recursively iterate and list files of.

Return

array The merged array.

Source

private static function recursively_iterate_json( $dir ) {
	$nested_files      = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ) );
	$nested_json_files = iterator_to_array( new RegexIterator( $nested_files, '/^.+\.json$/i', RecursiveRegexIterator::GET_MATCH ) );
	return $nested_json_files;
}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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