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::recursively_iterate_json( string $dir ): array

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


$dir string Required
The directory to recursively iterate and list files of.

Top ↑


array The merged array.

Top ↑


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

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;

Top ↑


Version Description
6.2.0 Introduced.

Top ↑

User Contributed Notes

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