diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php
index 9fa101906a..90dfdc2a55 100644
a
|
b
|
final class WP_Theme implements ArrayAccess { |
1483 | 1483 | |
1484 | 1484 | foreach ( $paths_to_index_block_template as $path_to_index_block_template ) { |
1485 | 1485 | if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) { |
1486 | | return true; |
| 1486 | $content = file_get_contents( $path_to_index_block_template ); |
| 1487 | $blocks = parse_blocks( $content ); |
| 1488 | |
| 1489 | if ( $blocks && array_filter( wp_list_pluck( $blocks, 'blockName' ) ) ) { |
| 1490 | return true; |
| 1491 | } |
1487 | 1492 | } |
1488 | 1493 | } |
1489 | 1494 | |
diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php
index 891e77748d..4d43d69237 100644
a
|
b
|
function get_query_template( $type, $templates = array() ) { |
63 | 63 | |
64 | 64 | $template = locate_template( $templates ); |
65 | 65 | |
66 | | $template = locate_block_template( $template, $type, $templates ); |
| 66 | if ( wp_is_block_theme() ) { |
| 67 | $template = locate_block_template( $template, $type, $templates ); |
| 68 | } |
67 | 69 | |
68 | 70 | /** |
69 | 71 | * Filters the path of the queried template by type. |