WordPress provides built-in tools to add essential metadata to images, including title, caption, alt text, and description. As experienced WordPress developers, we've optimized countless sites using these features. This metadata helps administrators organize media libraries, improves SEO for search engines, engages users with context, and ensures accessibility for visually impaired visitors via screen readers. In this expert guide, we'll show you how to implement it effectively.

Beginners often upload images without metadata, limiting their potential. Optimized images rank higher in search results, provide richer user experiences, and simplify site management.
Search engines like Google use metadata to understand and index images accurately, displaying them in relevant searches. Users gain insights through captions and descriptions, turning static visuals into compelling stories. For accessibility, alt text describes images for screen reader users.
In essence, metadata makes images more searchable, informative, engaging, and inclusive.
During upload via the Media Library, WordPress prompts for attachment details—the core of image metadata.

Attachment Title: Sets the image name for sorting in the Media Library.
Alt Text: Required by HTML standards, it displays if the image fails to load and serves as a key SEO signal for image search. See our guide on alt text vs. image title in WordPress.
Description: Appears on the image's attachment page. Use it for backstories, shooting details, or links.
Caption: Shows alongside the image, styled by your theme (inside or below). Learn more in our guide to adding captions.
WordPress also captures details like resolution, file size, thumbnails, and EXIF data automatically. Themes like Twenty Thirteen display some on attachment pages. Advanced users can customize via child themes.
Images are stored as 'attachment' post types. Title goes to post_title, description to post_content, caption to post_excerpt. Other data lives in the postmeta table, including dimensions and EXIF.
Customize attachment pages using child theme templates like image.php, attachment.php, or single-attachment.php. Default to single.php if absent. See our custom attachment template guide.
For Twenty Thirteen's image.php, add this code where desired:
<?php the_content(); ?> <?php $meta = wp_get_attachment_metadata( $post->ID ); echo "Resolution: " . $meta['width'] . " x " . $meta['height'] . "<br />"; echo "Credit: " . $meta['image_meta']['credit'] . "<br />"; echo "Camera: " . $meta['image_meta']['camera'] . "<br />"; echo "Focal Length: " . $meta['image_meta']['focal_length'] . "<br />"; echo "Aperture: " . $meta['image_meta']['aperture'] . "<br />"; echo "ISO: " . $meta['image_meta']['iso'] . "<br />"; echo "Shutter Speed: " . $meta['image_meta']['shutter_speed'] . "<br />"; $timestamped = $meta['image_meta']['created_timestamp']; $created_timestamp = date( "F j, Y, g:i a", $timestamped ); echo "Timestamp: " . $created_timestamp . "<br />"; echo "Copyright: " . $meta['image_meta']['copyright']; ?>
EXIF data comes from cameras/smartphones. Upload your photos to preserve it. Read our EXIF tags guide.

Disable comments on attachment pages if preferred. Note: Metadata works embedded in posts too—attachment pages are optional and can be disabled.
As attachments are post types, add custom fields like photographer details. Add this to functions.php or a plugin:
/**
* Add photographer name and URL fields to media uploader
*/
function be_attachment_field_credit( $form_fields, $post ) {
$form_fields['be-photographer-name'] = array(
'label' => 'Photographer Name',
'input' => 'text',
'value' => get_post_meta( $post->ID, 'be_photographer_name', true ),
'help' => 'Photo credit if provided.'
);
$form_fields['be-photographer-url'] = array(
'label' => 'Photographer URL',
'input' => 'text',
'value' => get_post_meta( $post->ID, 'be_photographer_url', true ),
'help' => 'Photographer website.'
);
return $form_fields;
}
add_filter( 'attachment_fields_to_edit', 'be_attachment_field_credit', 10, 2 );
/**
* Save photographer fields
*/
function be_attachment_field_credit_save( $post, $attachment ) {
if( isset( $attachment['be-photographer-name'] ) )
update_post_meta( $post['ID'], 'be_photographer_name', $attachment['be-photographer-name'] );
if( isset( $attachment['be-photographer-url'] ) )
update_post_meta( $post['ID'], 'be_photographer_url', esc_url( $attachment['be-photographer-url'] ) );
return $post;
}
add_filter( 'attachment_fields_to_save', 'be_attachment_field_credit_save', 10, 2 );New fields appear on upload.

Display with:
<?php echo get_post_meta( $post->ID, 'be_photographer_name', true ); ?> <?php echo get_post_meta( $post->ID, 'be_photographer_url', true ); ?>
Detailed tutorial: custom media fields.
This guide equips you to master image metadata. Explore our responsive galleries with Envira. Subscribe to our YouTube channel, follow on Twitter and Google+ for more.