WordPress post thumbnail alt
Easy access to the post thumbnail alt text by post ID.
function get_the_post_thumbnail_alt($post_id) {
return get_post_meta(get_post_thumbnail_id($post_id), '_wp_attachment_image_alt', true);
}
function the_post_thumbnail_alt($post_id) {
echo get_the_post_thumbnail_alt($post_id);
}
Written by pimschaaf
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#