Title: Getting image metadata
Last modified: August 19, 2016

---

# Getting image metadata

 *  [aicos](https://wordpress.org/support/users/aicos/)
 * (@aicos)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/getting-image-metadata/)
 * 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)

 *  [mrlarner](https://wordpress.org/support/users/mrlarner/)
 * (@mrlarner)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/getting-image-metadata/#post-905291)
 * 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](http://codex.wordpress.org/Function_Reference/get_children)
 * hope that helps!

Viewing 1 replies (of 1 total)

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

 * 1 reply
 * 2 participants
 * Last reply from: [mrlarner](https://wordpress.org/support/users/mrlarner/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/getting-image-metadata/#post-905291)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
