Skip to content

Commit eff273f

Browse files
committed
Fix undefined array key
1 parent 4b4cc4f commit eff273f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp-includes/block-template.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ function resolve_block_template( $template_type, $template_hierarchy, $fallback_
164164
$template_hierarchy
165165
);
166166

167-
$object = get_queried_object();
168-
$specific_template = $object ? get_page_template_slug( $object ) : null;
167+
$object_id = get_queried_object_id();
168+
$specific_template = $object_id && get_post( $object_id ) ? get_page_template_slug( $object_id ) : null;
169169
$active_templates = (array) get_option( 'active_templates', array() );
170170

171171
// We expect one template for each slug. Use the active template if it is
@@ -222,7 +222,7 @@ function ( $template ) {
222222
);
223223
$templates = array_merge( $templates, get_registered_block_templates( $query ) );
224224

225-
if ( $specific_template ) {
225+
if ( $specific_template && in_array( $specific_template, $remaining_slugs, true ) ) {
226226
$templates = array_merge( $templates, get_block_templates( array( 'slug__in' => array( $specific_template ) ) ) );
227227
}
228228

0 commit comments

Comments
 (0)