Skip to content

Commit 9704c13

Browse files
ellatrixAljullukmanijakbacoords
authored andcommitted
Template activation: skip gutenberg_get_registered_block_templates query when no slugs are left to find (#72795)
Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Aljullu <aljullu@git.wordpress.org> Co-authored-by: kmanijak <karolmanijak@git.wordpress.org> Co-authored-by: bacoords <bacoords@git.wordpress.org>
1 parent d7dd0a2 commit 9704c13

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

backport-changelog/6.9/10432.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
https://github.com/WordPress/wordpress-develop/pull/10432
22

3-
* https://github.com/WordPress/gutenberg/pull/72770
3+
* https://github.com/WordPress/gutenberg/pull/72770
4+
* https://github.com/WordPress/gutenberg/pull/72795

lib/compat/wordpress-6.9/template-activate.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,12 @@ function ( $template ) {
309309
}
310310

311311
// For any remaining slugs, use the static template.
312-
$query = array(
313-
'slug__in' => $remaining_slugs,
314-
);
315-
$templates = array_merge( $templates, gutenberg_get_registered_block_templates( $query ) );
312+
if ( ! empty( $remaining_slugs ) ) {
313+
$query = array(
314+
'slug__in' => $remaining_slugs,
315+
);
316+
$templates = array_merge( $templates, gutenberg_get_registered_block_templates( $query ) );
317+
}
316318

317319
if ( $specific_template && in_array( $specific_template, $remaining_slugs, true ) ) {
318320
$templates = array_merge( $templates, get_block_templates( array( 'slug__in' => array( $specific_template ) ) ) );

0 commit comments

Comments
 (0)