Skip to content

Commit

Permalink
render nothing if no featured image exists (#28625)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Feb 1, 2021
1 parent cf1b761 commit 173a5a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/block-library/src/post-featured-image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '<a href="%1s">%2s</a>', get_the_permalink( $post_ID ), $featured_image );
Expand Down

0 comments on commit 173a5a0

Please sign in to comment.