diff --git a/src/wp-includes/blocks/pattern.php b/src/wp-includes/blocks/pattern.php index fc4652a7c22e8..b6be0f0738f97 100644 --- a/src/wp-includes/blocks/pattern.php +++ b/src/wp-includes/blocks/pattern.php @@ -46,7 +46,6 @@ function render_block_core_pattern( $attributes ) { // Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin. // This can be removed when the minimum supported WordPress is >= 6.4. if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) { - $content = _inject_theme_attribute_in_block_template_content( $content ); $blocks = parse_blocks( $content ); $content = gutenberg_serialize_blocks( $blocks ); } diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php index 21a904ab8a691..3ad400906945b 100644 --- a/src/wp-includes/blocks/template-part.php +++ b/src/wp-includes/blocks/template-part.php @@ -18,14 +18,9 @@ function render_block_core_template_part( $attributes ) { $template_part_id = null; $content = null; $area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED; + $theme = isset( $attributes['theme'] ) ? $attributes['theme'] : get_stylesheet(); - if ( isset( $attribues['theme'] ) ) { - $theme = $attributes['theme']; - } else { - $theme = get_stylesheet(); - } - - if ( isset( $attributes['slug'] ) ) { + if ( isset( $attributes['slug'] ) && get_stylesheet() === $theme ) { $template_part_id = $theme . '//' . $attributes['slug']; $template_part_query = new WP_Query( array(