• Hi I don’t know if this is the right place to post or not, but I was wondering if some could tell me how to extract the contents from the image fields in the media library. I’ve been trying to get wp_get_attachment_metadata() to work some success.

    The thing is, the caption and description elements are blank when I examine the resulting array with print_r(). But all other elements are filled in. And they don’t seem to be in the “postmeta” table either. But when I look at the image fields again in the media library, they seem to have content.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • just stumbled across this post…

    attachments are stored like regular posts in the posts table. caption and description are stored are post_excerpt and post_content.

    if you are getting attachments with get_children you could do something like

    if($images =& get_children( 'post_type=attachment' )){
       foreach($images as $image){
          $caption = $image->post_excerpt;
          $description = $image->post_content;
          //do whatever
       }
    }

    get_children

    hope that helps!

Viewing 1 replies (of 1 total)

The topic ‘Getting image metadata’ is closed to new replies.