From 08cd8936426bda05ab72cc468daabe3cca4b4bf4 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Tue, 5 Dec 2023 15:44:13 +0100 Subject: [PATCH] Template Part block: Fix template part path arg missing from actions --- packages/block-library/src/template-part/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php index 26d90c51b5529..0c97f88b98e38 100644 --- a/packages/block-library/src/template-part/index.php +++ b/packages/block-library/src/template-part/index.php @@ -70,6 +70,12 @@ function render_block_core_template_part( $attributes ) { if ( isset( $block_template->area ) ) { $area = $block_template->area; } + + // Needed for the `render_block_core_template_part_file` and `render_block_core_template_part_none` actions below. + $block_template_file = _get_block_template_file( 'wp_template_part', $attributes['slug'] ); + if ( $block_template_file ) { + $template_part_file_path = $block_template_file['path']; + } } if ( '' !== $content && null !== $content ) {