From ac34493785a413d666098e3115a6352fb8c17714 Mon Sep 17 00:00:00 2001 From: Bernie Reiter <96308+ockham@users.noreply.github.com> Date: Tue, 25 Feb 2025 20:59:36 +0100 Subject: [PATCH] Template Part block: Guard against `get_block_file_template` returning `null` (#69309) Co-authored-by: ockham Co-authored-by: paulopmt1 Co-authored-by: josephscott --- packages/block-library/src/template-part/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php index be867c4ced1660..c73b64408733dc 100644 --- a/packages/block-library/src/template-part/index.php +++ b/packages/block-library/src/template-part/index.php @@ -70,7 +70,9 @@ function render_block_core_template_part( $attributes ) { if ( 0 === validate_file( $attributes['slug'] ) ) { $block_template = get_block_file_template( $template_part_id, 'wp_template_part' ); - $content = $block_template->content; + if ( isset( $block_template->content ) ) { + $content = $block_template->content; + } if ( isset( $block_template->area ) ) { $area = $block_template->area; }