Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wp get image alt

// An attachment/image ID is all that's needed to retrieve its alt and title attributes.
$image_id = get_post_thumbnail_id();

$image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);

$image_title = get_the_title($image_id);
Source by wordpress.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #wp #image #alt
ADD COMMENT
Topic
Name
6+3 =