diff --git a/packages/block-library/src/pattern/index.php b/packages/block-library/src/pattern/index.php index 1f5477968b92d1..f05bb333bd186d 100644 --- a/packages/block-library/src/pattern/index.php +++ b/packages/block-library/src/pattern/index.php @@ -44,7 +44,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/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php index a7bd4033affc34..3ad400906945b8 100644 --- a/packages/block-library/src/template-part/index.php +++ b/packages/block-library/src/template-part/index.php @@ -18,13 +18,10 @@ 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( $attributes['slug'] ) && - isset( $attributes['theme'] ) && - get_stylesheet() === $attributes['theme'] - ) { - $template_part_id = $attributes['theme'] . '//' . $attributes['slug']; + if ( isset( $attributes['slug'] ) && get_stylesheet() === $theme ) { + $template_part_id = $theme . '//' . $attributes['slug']; $template_part_query = new WP_Query( array( 'post_type' => 'wp_template_part', @@ -34,7 +31,7 @@ function render_block_core_template_part( $attributes ) { array( 'taxonomy' => 'wp_theme', 'field' => 'name', - 'terms' => $attributes['theme'], + 'terms' => $theme, ), ), 'posts_per_page' => 1,