Flexible Map > Still Problems with Google Maps API Key
-
Hello members.
I somehow cannot figure it out: the Google Maps API Key does not seem to be output in the markup of the Flexible Map plugin although the key is setup in the settings area of Flexible Map.
1
To make sure the API key works I tried a Google quickstart guide, added my API-Code, uploaded it to my site and made sure that the domain settings (*.mydomain.com/*) were setup correctly in the Google Dev Console. That worked. The map was shown.2
But whenever I use a Flexible Map shortcode in my theme’s code, the output is broken and I receive the well known JS Error in the JS console. “MissingKeyMapError” as referenced here: https://developers.google.com/maps/documentation/javascript/error-messages#deverrorcodesThis is the Shortcode I am using in functions.php via do_shortcode():
[flexiblemap address=”‘.$mapAddress.'” title=”‘.$name.'” description=” ‘.$mapAddress.'” directions=”false” width=”100%” height=”280px”]’3
As a “dirty” workaround I added the script manually to the footer of my site using:<script async defer src=”https://maps.googleapis.com/maps/api/js?key=xxx” type=”text/javascript”></script>
(xxx is replaced with my correct API Key), which produces a warning (about having included the API script twice) in the JS console. But at least renders the map in a static way (without markers and all) and without showing the users of the site an error message (an no map at all).
4
From my point of view it seems that Flexible Map is not enqueuing the api script correctly inlcuding the key value. In the markup (when not using the additional footer output mentioned above) I only see the line https://maps.googleapis.com/maps/api/js without the key parameter.Any help is highly appreciated.
Many thanks.
Karl
The topic ‘Flexible Map > Still Problems with Google Maps API Key’ is closed to new replies.