admin管理员组

文章数量:1417555

wp_get_attachment_metadata( get_post_thumbnail_id( get_the_ID() ) )['image_meta']['credit'] returns nothing although there IS information in the attachment's credit field.

Is wp_get_attachment_metadata for that EXIF data stuff or is it for the fields in the media manager?

Am I stupid?

wp_get_attachment_metadata( get_post_thumbnail_id( get_the_ID() ) )['image_meta']['credit'] returns nothing although there IS information in the attachment's credit field.

Is wp_get_attachment_metadata for that EXIF data stuff or is it for the fields in the media manager?

Am I stupid?

Share Improve this question asked Jan 19, 2016 at 20:20 corysimmonscorysimmons 2111 gold badge2 silver badges6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It is for EXIF data.

But if that's the code you're using, it looks like you are trying to access array elements on a function call.

Try

$my_data = wp_get_attachment_metadata( get_post_thumbnail_id( get_the_ID() ) );

echo $my_data['image_meta']['credit'];

本文标签: post thumbnailswpgetattachmentmetadata()39imagemeta39 fetch WP metadata or EXIF