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.

_get_block_templates_paths() WordPress Function

The get_block_templates_paths() function is used to get the path to the folder containing the block templates.

_get_block_templates_paths( string $base_directory ) #

Finds all nested template part file paths in a theme’s directory.


Parameters

$base_directory

(string)(Required)The theme's file path.


Top ↑

Return

(array) A list of paths to all template part files.


Top ↑

Source

File: wp-includes/block-template-utils.php

function _get_block_templates_paths( $base_directory ) {
	$path_list = array();
	if ( file_exists( $base_directory ) ) {
		$nested_files      = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) );
		$nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH );
		foreach ( $nested_html_files as $path => $file ) {
			$path_list[] = $path;
		}
	}
	return $path_list;
}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.