Advanced Custom Fields – Google Map Won’t Render Unless Variable Dumped

Try this code:

<div class="map">
    <?php 
        global $post;
        $location = get_field('location', $post->ID);
    ?>
        <div class="acf-map">
            <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
        </div>
</div>

Sometimes in the template you’re loading this you don’t have the post that the field belongs to, so you can try to fetch it in the global $post variable.

error code: 523