if you put full code(that you show us) in a separate file and only captions are empty, then problem is somewhere else.
because you will/should see nothing or everything.
i assume you have a flexible-field or repeater field, and inside that you have:
1 image field (image), and 2 text-fields (title and caption)?
or do you only have 1 image field and try to use caption and title of it? if it is like that, then use:
$title = $image['title']; $alt = $image['alt']; $caption = $image['caption'];
instead of get_sub_field for title and caption
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Sorry for the issues with ACF's API SSL certificate this morning. We've resolved it and your activations and downloads should be back to normal again. Thanks! ^LG— Advanced Custom Fields (@wp_acf) November 2, 2022
© 2022 Advanced Custom Fields.