Getting alt text of featured image


I’m trying to get the alt text of our featured image and have it output on the frontend.

Currently my code is

<img class="vehicle-photo" src="<?php echo the_post_thumbnail_url() ?>" alt="<?php the_post_thumbnail_caption();?>" />

But on the frontend, it is outputting as

<img class="vehicle-photo" src="photo url here" alt="">
Matt 4 weeks 0 Answers 5 views 0

Leave an answer