Я делал так
HTML
<section class="map" id="map" data-long="<?php echo get_field('b10_map')['lng']; ?>" data-lat="<?php echo get_field('b10_map')['lat']; ?>"></section>
JS
var gmap = document.getElementById('map');
var latitude = parseFloat(gmap.dataset.lat);
var longitude = parseFloat(gmap.dataset.long);
function initMap() {
var place = {
lat: latitude, // широта
lng: longitude // долгота
};
var map = new google.maps.Map(
document.getElementById('map'), {
zoom: 18,
center: place
});
var marker = new google.maps.Marker({
position: place,
map: map
});
}
FUNCTIONS.PHP
function my_acf_init() {
acf_update_setting('google_api_key', 'YOUR API KEY');
}
add_action('acf/init', 'my_acf_init');