Getting alt text of featured image

Question

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="">
0
Matt 2 years 2020-12-22T23:10:28-05:00 0 Answers 5 views 0

Leave an answer

Browse
Browse