Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Add EXIF Photo Tags in WordPress

Do you need to add EXIF photo tags in WordPress?

EXIF tags contain helpful information about your photos, such as the time and location the photo was taken and the camera that was used. Photographers often want to show this information with their photographs.

In this article, we’ll show you how to add EXIF photo tags in WordPress.

How to Add EXIF Photo Tags in WordPress

Why Display EXIF Information in WordPress?

Many photographers use a WordPress website to showcase their images because it offers useful plugins and beautiful photography themes.

Most cameras use the exchangeable image file format (EXIF) to store lots of metadata inside the image file. This usually includes the camera manufacturer and model, resolution and exposure information, the location and time the photo was taken, and much more.

Displaying these EXIF tags on your website can add even more interest to your photos and increase engagement with other photographers who visit your site.

With that being said, let’s look at how to add EXIF photo tags to your WordPress site. We’ll cover two methods, and most users will find the first method simpler.

Method 1: Adding EXIF Tags to Captions of Specific Photos

The first thing you need to do is install and activate the Exif Caption plugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin is a good choice if you don’t want to display EXIF data on all your photos. It makes it simple to choose the EXIF tags you wish to use, and then adds them only to the captions of the images you select.

To use the plugin, you need to navigate to Media » Exif Caption. There you’ll see a list of all of your photos that contain EXIF data.

Navigate to Media » Exif Caption

To configure the plugin, you need to click the ‘Settings’ disclosure triangle. Here you’ll find a checkbox that lets you add the EXIF data to the image’s alt text in addition to the caption. For this tutorial, we’ll leave the box unchecked.

Click Settings to Configure the Plugin

After that, you can choose whether to replace the current caption with EXIF data or display it alongside. If you don’t want to lose your current captions, then make sure you select the ‘Insert to right’ option.

Next, you’ll find a box that contains all of the EXIF tags that can be added to the caption. Simply delete any that you do not wish to display.

Once you’ve finished choosing your settings, make sure you click the ‘Save Changes’ button.

Now you can add the EXIF data to the captions of your photos. Simply click the checkbox next to the photos that have EXIF data you wish to display.

Click the Checkbox Next to the Photos

When you’re done, simply click the ‘Update’ button. The EXIF tags will be copied into the captions of the selected photos. If you checked the ‘Insert into alt at the same time’ option, then they will also be copied into the alt text field.

The EXIF Tags Will Be Copied into the Captions of the Selected Photos

When you use any of those images in a post, the EXIF tags will be displayed in the caption.

EXIF Caption Preview

Method 2: Automatically Displaying EXIF Data on All Your Photos

This method is the best option if you want to automatically display EXIF tags for all your photos, or if you want to customize the way those tags are displayed. But it’s not recommended for beginners because it requires you to add code to your theme files.

First, you need to install and activate the Exif Details plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Once activated, you’ll see a new column containing EXIF tags when you visit Media » Library.

A New Column Displays EXIF Tags

Now you can see which EXIF codes are available in your photos. You can then use code to automatically display those tags in your theme.

For example, the following code snippet will automatically display the date the photo was taken using the date format and timezone you selected in your website’s general settings.

If this is your first time adding code to your WordPress files, then you should check out our guide on how to copy and paste code snippets in WordPress.

When you’re ready, you need to add the following code in your theme’s functions.php file or a site-specific plugin.

 * Display photograph's date in image block captions.
function wpb_show_photo_date( $content, $block ) {
    // Determine image ID.
    if ( empty( $block['attrs']['id'] ) ) {
        // No image ID available.
        return $content;
    $image_id = $block['attrs']['id'];
    // Determine photograph's date is recorded in meta data.
    $exif_data = get_post_meta( $image_id, '_exif_details', true );
    if ( ! $exif_data ) {
        // No exif data.
        return $content;
    if ( empty( $exif_data['DateTimeOriginal'] ) ) {
        // Date not recorded.
        return $content;
    // Everything's dandy: add date to caption.
    // Determine date.
    $date_time = date_create_from_format( 'Y:m:d H:i:s', $exif_data['DateTimeOriginal'], new DateTimeZone( 'UTC' ) );
    $date_time->setTimezone( new DateTimeZone( wp_timezone_string() ) );
    $timestamp_with_offset = $date_time->getTimestamp() + $date_time->getOffset();
    $display_date = date_i18n( get_option( 'date_format' ), $timestamp_with_offset );
    // Prepare to replace/add caption.
    $replacement_string = '';
    $replacement_suffix = '';
    if ( strpos( $content, '</figcaption>' ) !== false ) {
        $search = '</figcaption>';
        $replacement_string .= ' -- ';
    else {
        $search = '</figure>';
        $replacement_string .= '<figcaption>';
        $replacement_suffix = '</figcaption>';
    $replacement_string .= 'Photographed: ' . esc_html( $display_date );
    $replacement_string .= $replacement_suffix . $search;
    $content = str_replace( $search, $replacement_string, $content );
    return $content;
add_filter( 'render_block_core/image', 'wpb_show_photo_date', 10, 2 );
Exif Details Code Snippet

The benefit of this code snippet is that it doesn’t store the EXIF data in the image’s caption field, but displays it in real time. If the image already has a caption, then the EXIF data will be displayed after it.

If you’re familiar with PHP, then you can modify the code to display other EXIF tags.

Here’s a screenshot of how it looks on our demo site.

Exif Details Preview

You’ll also find some code snippet examples on the Exif Details plugin page. Be aware that these snippets will store the EXIF tags in the image’s caption in WordPress rather than generating them automatically each time.

We hope this tutorial helped you learn how to add EXIF photo tags in WordPress. You may also want to learn how to create a file upload form, or check out our list of the best Instagram plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions


  1. Congratulations, you have the opportunity to be the first commenter on this article.
    Have a question or suggestion? Please leave a comment to start the discussion.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.