Working from the examples here:
https://www.advancedcustomfields.com/resources/image/
Trying to use Display image (ID) to get responsive images.
Modified this slightly to try to get the title tag in place, which our SEO team requires. Here’s my code:
<?php
$image = get_sub_field('photo') ;
$size = 'large';
$alt = $image['alt'];
$title = $image['title'];
;?>
<?php if( $image ) {
echo wp_get_attachment_image( $image, $size, $alt, $title );
};
?>
Using $title works fine with the Display image (array) example.
Assuming wp_get_attachment_image is the issue… doesn’t include the title hence it returns nothing? Would seem we’d either have to sacrifice SEO or responsive images, which is a problem either way.
Been over a week… maybe I should submit this as a regular support ticket?
the function does not allow $alt or $title the way that you are attempting to use it.
https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
try
echo wp_get_attachment_image( $image, $size, false, array('alt'=>$alt,'title'=>$title));