If statement to check if post has image July 12, 2022 by Tarik Billa wp_get_attachment_image_src will return false if there is no image. So before you echo the image add if ($image !=false)