diff --git a/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php index 09b1664723419..84e3a985ec441 100644 --- a/packages/block-library/src/template-part/index.php +++ b/packages/block-library/src/template-part/index.php @@ -75,7 +75,7 @@ function render_block_core_template_part( $attributes ) { foreach ( $themes as $theme ) { $theme_folders = get_block_theme_folders( $theme ); - $template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $theme_folders['slug'] . '.html' ); + $template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' ); if ( file_exists( $template_part_file_path ) ) { $content = (string) file_get_contents( $template_part_file_path ); $content = '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : '';