From 173a5a0a8ebf8897142e7784ffbd043ae1263512 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Mon, 1 Feb 2021 13:26:03 +0200 Subject: [PATCH] render nothing if no featured image exists (#28625) --- packages/block-library/src/post-featured-image/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/block-library/src/post-featured-image/index.php b/packages/block-library/src/post-featured-image/index.php index 2822fb352f8a73..e4b613b4cd6fac 100644 --- a/packages/block-library/src/post-featured-image/index.php +++ b/packages/block-library/src/post-featured-image/index.php @@ -20,6 +20,9 @@ function render_block_core_post_featured_image( $attributes, $content, $block ) $post_ID = $block->context['postId']; $featured_image = get_the_post_thumbnail( $post_ID ); + if ( ! $featured_image ) { + return ''; + } if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $featured_image = sprintf( '%2s', get_the_permalink( $post_ID ), $featured_image );