[ad_1]
I assume, with “ACF” you mean “Advanced Custom Fields”?
If this is the case, you should start with the documentation at https://www.advancedcustomfields.com/resources/get_field/.
The post ID required for get_field() is also passed to the caption filter.
So it may be something like this if you want to add the custom field content below the existing caption (untested, but the idea should be clear):
function my_lbwps_caption_caption($caption, $id)
{
$fieldContent = get_field('my_field_name', $id);
// Combine original caption and field content with a <br>
return sprintf('%s<br>%s', $caption, $fieldContent);
}
add_filter('lbwps_caption_caption', 'my_lbwps_caption_caption', 10, 2);`
