Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp-includes/block-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function _add_template_loader_filters() {
* @global string $_wp_current_template_content
* @global string $_wp_current_template_id
*
* @param string $template Path to the template. See locate_template().
* @param string $template Path to the template.
* @param string $type Sanitized filename without extension.
* @param string[] $templates A list of template candidates, in descending order of priority.
* @return string The path to the Site Editor template canvas file, or the fallback PHP template.
Expand All @@ -37,7 +37,7 @@ function locate_block_template( $template, $type, array $templates ) {
global $_wp_current_template_content, $_wp_current_template_id;

if ( ! current_theme_supports( 'block-templates' ) ) {
return $template;
return '';
}

if ( $template ) {
Expand Down
8 changes: 5 additions & 3 deletions src/wp-includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ function get_query_template( $type, $templates = array() ) {
*/
$templates = apply_filters( "{$type}_template_hierarchy", $templates );

$template = locate_template( $templates );

$template = locate_block_template( $template, $type, $templates );
$block_template = locate_block_template( '', $type, $templates );
if ( $block_template ) {
return $block_template;
}

$template = locate_template( $templates );
/**
* Filters the path of the queried template by type.
*
Expand Down