The array is working fine on local machine and loops through the images but it fails to work on the aws server. It says "Trying to access array offset on value of type null".
<?php
$image1 = get_field('add_image');
$image2 = get_field('add_image2');
$image3 = get_field('add_image3');
$images = array($image1, $image2, $image3);
?>
<?php $count = 0; ?>
<?php foreach($images as $value): ?>
<img src="<?php echo esc_url($value['url']); ?>" class="d-block w-100 wrap-image-single responsive " alt="..."> </a>
<?php $count++; endforeach; ?>
2
Answers
You may wish to try some basic debug…
var_dump($image1)
$images
array and see what you have. Do you in fact have the ‘url’ key on each sub-array?This might be a minor issue. Here is my process of debugging the issue:
add_image2, add_images3
for the functionget_field
These are my two cents. Let me know how it goes .. 🙂