It seems that there are missing Gooogle Maps Api keys, because if I deactivate your plugin, browser console is empty but If your plugin is active, console logs:
maps.googleapis.com/maps-api-v3/api/js/26/16/intl/de_ALL/util.js:210 Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
TA.j @ maps.googleapis.com/maps-api-v3/api/js/26/16/intl/de_ALL/util.js:210
maps.googleapis.com/maps-api-v3/api/js/26/16/intl/de_ALL/util.js:210 Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
Now I am asking myself, why do you include your own google maps api scripts and not the once from the default acf google maps fields.? For acf I have added an API Code Like this:
function acf_init_gmaps_api_key() { acf_update_setting('google_api_key', 'AIzaSyAFpWUhAGXWIXnh-mBNCtfCCHPRxd8qCmA'); }
add_action('acf/init', 'acf_init_gmaps_api_key');
function my_acf_google_map_api( $api ) { $api['key'] = 'AIzaSyAFpWUhAGXWIXnh-mBNCtfCCHPRxd8qCmA'; return $api; }
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
So now I found your plugin files where you enqueue you custom google maps script:
wp_enqueue_script(array($this->settings['script-handle']));
- acf-google-map-extended-v4.php, line 34
- acf-google-map-extended-v5.php, line 31
which you register before without GM API key:
wp_register_script("googlemaps-api", "//maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=places",array(),'3',false);
You have no filter for adding an API key but acf has, so why do you enqueue your own script? If I delete the line:
wp_enqueue_script(array($this->settings['script-handle']));
in both mentioned files, everything works fine.
Can you please change this behaviour, so that not everything crashes with the next update?
Solution:
Apply the acf filter for including a custom google maps api key like this:
File: acf-google-map-extended-v5.php
function input_admin_enqueue_scripts() {
$gm_api = apply_filters('acf/fields/google_map/api');
wp_register_script("googlemaps-api", "//maps.googleapis.com/maps/api/js?key=".$gm_api['key']."&v=3&sensor=false&libraries=places",array(),'3',false);
wp_register_script($this->settings['script-handle'], $this->settings['url'] . '/js/input.js', array($this->settings['acf-script-handle'],'jquery','googlemaps-api'), $this->settings['version'],false);
wp_register_style($this->settings['script-handle'], $this->settings['url'] . '/css/input.css', array($this->settings['acf-script-handle']), $this->settings['version']);
wp_enqueue_script(array($this->settings['script-handle']));
wp_enqueue_style(array($this->settings['script-handle']));
}