From 5218a1284f2dc1c66e9723dc42915d8afd9aab94 Mon Sep 17 00:00:00 2001 From: leogermani Date: Mon, 26 Aug 2024 10:32:43 -0300 Subject: [PATCH] fix: avoid warnings (#2367) --- newspack-theme/inc/template-tags.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/newspack-theme/inc/template-tags.php b/newspack-theme/inc/template-tags.php index a7f32d5a6..219a63887 100755 --- a/newspack-theme/inc/template-tags.php +++ b/newspack-theme/inc/template-tags.php @@ -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 ) {