From b598ec49cfee55a09554182028ba7f008b762feb Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 1 Feb 2021 12:26:02 +0200 Subject: [PATCH] render nothing if no featured image exists --- 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 2822fb352f8a7..e4b613b4cd6fa 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 );