Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#45776 closed enhancement (wontfix)

Getting current post’s featured image and its alt attribute

Reported by: rajanit2000's profile rajanit2000 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Post Thumbnails Keywords: dev-feedback
Focuses: Cc:

Description

There is have no function getting post thumbnail metadata. If we create a function it would be useful

https://wordpress.org/support/topic/getting-current-posts-featured-image-and-its-alt-attribute/

Change History (4)

#1 @swissspidy
5 years ago

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.

#2 @rajanit2000
5 years ago

@swissspidy Yes but I hope somebody they did not know about the meta key name "_wp_attachment_image_alt". That's why am asking about the function

#3 @joyously
5 years ago

I think he was wanting it in the editor.

#4 @swissspidy
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Indeed. I replied on the support thread accordingly.

Closing this one as a wontfix as I don't think it's needed at the moment.

Note: See TracTickets for help on using tickets.