I'm trying to display the Google Map object created using the Advanced Custom Field plugin's built-in generator.
I used the stock Javascript/CSS/PHP outlined here as this exactly matches my use case: https://www.advancedcustomfields.com/resources/google-map/
Only problem: The jQuery script seems unable to find the lat/lng html attributes unless the php variable is dumped or echoed in some way.
<div class="map">
<?php
$location = get_field('location');
var_dump($location); <-- Why is this necessary?
?>
<div class="acf-map">
<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
</div>
</div>
My knowledge of PHP is clearly inadequate to understand why this might be the case. The Javascript is being included in an inline script tag within the PHP file itself.