Skip to content

Showing all EXIF/meta data for an image

When images are uploaded to WordPress/Sunshine Photo Cart for your client photo galleries, most of the EXIF data is saved to the database. By default, Sunshine does not use this for anything except for searching but it is also available to use for display with custom code. Below is an example of showing all available meta data for a single image. You can also show just the keywords for an image.

add_action( 'sunshine_after_image', 'sunshine_exif_data' );
function sunshine_exif_data( $image ) {
	$meta = wp_get_attachment_metadata( $image->get_id() );
	$image_meta = $meta['image_meta'];
	foreach ( $image_meta as $key => $value ) {
		if ( !empty( $value ) ) {
			echo ucwords( $key ) . ': ';
			if ( is_array( $value ) ) {
				echo join( ', ', $value );
			} else {
				echo $value;
			echo '<br />';

Learn how to add this custom code to your WordPress website

Still need help?

If you have not yet found your answer in the documentation articles, please contact support