Image Metadata in WordPress

add function in functions.php:

function myMetaData($pic) {
$html = ”;
$meta = wp_get_attachment_metadata($pic);
if($meta) {
$html = ‘

    ‘;
    foreach($meta[‘image_meta’] as $key => $value) {
    $html .= ‘

  • ‘ . $key . ‘: ‘ . $value . ‘
  • ‘;
    }
    $html .= ‘

‘;
}
return $html;
}

In image.php of the default theme we are inserting above the_content (Line 12) the new function:

<?php echo myMetaData($post->ID); ?>


Image Metadata