I have some IDs of attachments (images, not from current post). How to I get the alt attribute for those images?
I have tried to look into wp_get_attachment_image_src and wp_get_attachment_metadata but couldn't find the alt attribute stored in neither of those
this is where I'm looking for the alt:
while(the_repeater_field('featured_pics')): //this is an array of IDs $image_id = get_sub_field('featured_pic'); // this function gets an individual ID from array $image_attr = wp_get_attachment_image_src(get_sub_field('featured_pic'), 'medium'); echo '<li class="showcase-pic"><a href="'.$image_attr.'" rel="lightbox">'.wp_get_attachment_image($image_id, 'thumbnail').'</a></li>'; endwhile;