Leave a Reply

2 comments

  1. WordPress will store any EXIF data it can retrieve at point-of-upload into the attachment metadata array (which is serialized in the postmeta table under the key _wp_attachment_metadata).

    You can retrieve this metadata using wp_get_attachment_metadata($attachment_ID).

    To add your own fields to the edit attachment form, check out get_attachment_fields_to_edit() in wp-admin/includes/media.php (line 1034 as of 3.0).

    You can filter attachment_fields_to_edit, passing back a structured array like so;

    function add_my_attachment_field($fields, $post)
    {
        $fields['my_field'] = array(
            'label'      => 'My Label',
            'input'      => 'html',
            'html'       => "<input type='text' class='text' name='my_field' value='my_value' />",
            'value'      => 'my_value',
            'helps'      => 'Helper text'
        );
        return $fields;
     }
     add_filter('attachment_fields_to_edit', 'add_my_attachment_field', 10, 2);