Skip to content

Commit

Permalink
fix: avoid warnings (#2367)
Browse files Browse the repository at this point in the history
  • Loading branch information
leogermani authored Aug 26, 2024
1 parent 38a50a5 commit 5218a12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion newspack-theme/inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ function newspack_post_thumbnail_caption() {
}

// Check the existance of the caption separately, so filters -- like ones that add ads -- don't interfere.
$caption_exists = get_post( get_post_thumbnail_id() )->post_excerpt;
$thumbnail = get_post( get_post_thumbnail_id() );
$caption_exists = $thumbnail && $thumbnail->post_excerpt;

// Only get the caption if one exists.
if ( $caption_exists ) {
Expand Down

0 comments on commit 5218a12

Please sign in to comment.