[wp-trac] [WordPress Trac] #45776: Getting current post’s featured image and its alt attribute

WordPress Trac noreply at wordpress.org
Thu Dec 27 11:56:26 UTC 2018


#45776: Getting current post’s featured image and its alt attribute
-----------------------------+------------------------------
 Reporter:  rajanit2000      |       Owner:  (none)
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Post Thumbnails  |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  dev-feedback     |     Focuses:
-----------------------------+------------------------------

Comment (by swissspidy):

 `get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true
 );` works just fine for this. Personally I don't see how an extra function
 for this is any more useful than this one liner. Especially if it's just
 for the featured image and not attachments in general.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45776#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list