admin管理员组文章数量:1323224
I'm trying to find all the meta fields that are used for an attachment: like Title, alternative text, description and caption . I've looked all over and the only one I was able to find was for an Alternative text, which is _wp_attachment_image_alt
.
I'm trying to find all the meta fields that are used for an attachment: like Title, alternative text, description and caption . I've looked all over and the only one I was able to find was for an Alternative text, which is _wp_attachment_image_alt
.
1 Answer
Reset to default 1You can easily inspect all the metadata for any post like so:
// 123 is the (attachment) post ID
var_dump( get_post_meta( 123 ) );
And in a default WordPress setup with no plugins or theme which add custom metadata to the image attachment post, the metadata you'd get are:
_wp_attached_file
— string, the image file (path and name) for the attachment post_wp_attachment_metadata
— array (serialized), the sizes for the image like 'thumbnail' (including original size), and metadata from EXIF/IPTC info._wp_attachment_image_alt
— string, the image's alternative text
As for the other details like the image title, they are in the post data (in the posts database table), so you can for example use wp_update_post()
to update these details:
post_title
— image titlepost_excerpt
— image captionpost_content
— image description
本文标签: functionsWhat are the meta fields for an attachment
版权声明:本文标题:functions - What are the meta fields for an attachment? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742066996a2418894.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论