Support

Account

Home Forums General Issues Accessing Image Caption and Description

Helping

Accessing Image Caption and Description

  • I’m trying to access the caption and description of my custom image field, and can’t seem to get to it. I have created a template that changes the image source of a thumbnail to display the main image. I would love to display a caption under that, but can’t seem to figure it out.

  • Hi @jmtaha,

    Set the ‘return value’ option for your image field to ‘Image Array’. Then access the caption and description for the selected image in your image field as shown below:

    $image = get_field('image_field_name);
    
    echo $image['caption']; // image caption
    echo $image['description']; // image description

    Have a look at the docs >> Image field for more info.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Accessing Image Caption and Description’ is closed to new replies.