Skip to content

Commit 62e0be6

Browse files
committed
Carry over changes from GB PR #55217
1 parent 356b085 commit 62e0be6

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/wp-includes/blocks/template-part.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ function render_block_core_template_part( $attributes ) {
1919
$content = null;
2020
$area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
2121

22-
if (
23-
isset( $attributes['slug'] ) &&
24-
isset( $attributes['theme'] ) &&
25-
get_stylesheet() === $attributes['theme']
26-
) {
27-
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
22+
if ( isset( $attribues['theme'] ) ) {
23+
$theme = $attributes['theme'];
24+
} else {
25+
$theme = get_stylesheet();
26+
}
27+
28+
if ( isset( $attributes['slug'] ) ) {
29+
$template_part_id = $theme . '//' . $attributes['slug'];
2830
$template_part_query = new WP_Query(
2931
array(
3032
'post_type' => 'wp_template_part',
@@ -34,7 +36,7 @@ function render_block_core_template_part( $attributes ) {
3436
array(
3537
'taxonomy' => 'wp_theme',
3638
'field' => 'name',
37-
'terms' => $attributes['theme'],
39+
'terms' => $theme,
3840
),
3941
),
4042
'posts_per_page' => 1,

0 commit comments

Comments
 (0)