Support

Account

Home Forums Backend Issues (wp-admin) Google Maps field needs setting to add API key

Solving

Google Maps field needs setting to add API key

  • spoke too soon. It worked great for the front end display of the map but my back end is still giving me troubles. I will keep checking in to see how this is progressing.

  • @heidijoe quoting the WP Codex “wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end.”
    If you’re using the ACF Google Maps field and want a temporary solution for the API key problem while we wait for a proper ACF update, follow the steps I mentioned in my first post on the previous page.

  • Hey,
    I have the same issue on the classic ACF plugin (Not Pro) only on production environment and tried all your tricks without success…

    – Changed the input.min.js file
    – added the enqueue script in my function.php
    – added the ?v=3.exp to the api-link

    but nothing’s working…

    Can somebody help me ?

    Best Regards

  • roms42, Please check have you enabled all the features for Google API key.

    – make sure the Google Maps Api’s are enabled:

    Google Maps Directions API
    Google Maps Distance Matrix API
    Google Maps Elevation API
    Google Maps Geocoding API
    Google Maps JavaScript API
    Google Places API Web Service
    Google Static Maps API

  • @killexx thanks for your answer, I have already set the api as below :

    Google Maps Directions API Désactiver
    Google Maps Distance Matrix API Désactiver
    Google Maps Elevation API Désactiver
    Google Maps Geocoding API Désactiver
    Google Maps JavaScript API Désactiver
    Google Places API Web Service Désactiver
    Google Static Maps API Désactiver

    The front diplay of the map is okay but always the same issue in backend

  • As I’m only using the Pro version, I can’t help you out on this one.

    PS: if you like using ACF for your projects, consider buying the Pro version

  • @roms42 for a free plugin I’ve made the same as 7am did (https://support.advancedcustomfields.com/forums/topic/google-maps-field-needs-setting-to-add-api-key/#post-40317). I’ve added my Google API to input.min.js, and that is all. Perhaps you’ve made too many changes and something causes an error.

  • Oh I did not see that there were 2 times the sensor parameter in the input.min.js file !

    That works fine for me now <3

    Thanks you for your help @killexx and @Joachim : in fact I think I would use the pro version for my next projects 😉

    Best Regards

  • I changed my quote to make it more explicit. 😉

  • @joachim I’ve completed your recommended steps to add the API key to /wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js – This allows the maps to appear in my edits screens – but I can only click to drop a pin on the map, but can’t type the address in the box. I seem to have all API’s enabled – but maybe you could provide more details to ensure they are enabled. I saw that if I went to developers.google.com and went to the ‘enabled APIs’ tab, it showed 5 that were enabled.

    Any other tips to get the ability back for typing addresses in the edit screens?

    Thanks,
    Stephen

  • I tried to get a workaround with the beta version, but until now I dind’t get it to work in the backend. Hope there will be I solution soon.

  • Hi, I tried all the solutions above and none of them seemed to be working for me.

    My issue is when I edit a page on WordPress with Map ACF and search for a location in the input field I got this message in the console :

    _.bb @ js?v=3&libraries=places&callback=google.loader.callbacks.maps:35
    acf-input.min.js?ver=5.4.0-beta3:1 Geocoder failed due to: REQUEST_DENIED

    -I got the script-tag with the right settings in a php file that is being included in Page.php
    -I got a function that is calling the script in Functions.php
    -I modified the acf-input.min.js file
    -I got the beta version 5.4.0-beta3. (I tried before with the current version of the plugin)
    -My API Key has all of them :
    Google Maps Directions API
    Google Maps Distance Matrix API
    Google Maps Elevation API
    Google Maps Geocoding API
    Google Maps JavaScript API
    Google Places API Web Service
    Google Static Maps API

    Any other solutions?

    Thanks

  • This reply has been marked as private.
  • I found for the backend maps to work you will need the 5.4 beta version and the filter in functions.php

    function my_acf_init() {
    	acf_update_setting('google_api_key', 'your_api_key');
    }
    
    add_action('acf/init', 'my_acf_init');
  • @pgrapes , this work just perfect. Thanks a lot for such an easy fix!

    Waiting for the update with the UI related field to pass the key value, adding the key hard coded is not a solution.

  • @stemlund
    got the same problem. Added an API key (without referer protection because it never worked) and all I can do is add a pin but not search within the address field.

    it is disabled (see source code).

    Edit: after activating “Google Maps Geolocation API” and reloading the backend it seems to enable the address field search.

  • So i had the 5.3.10 version and i added the code to my functions.php

    
    function my_acf_init() {
    	acf_update_setting('google_api_key', 'your_api_key');
    }
    add_action('acf/init', 'my_acf_init');
    

    My API key is domain-less, i worked with the temporary fix (changing the key in acf-input.min.js) in the past month and it went fine.

    Now i get MissingKeyMapError in wp-admin and i cant use the maps
    Updated to 5.4 BETA and its still the same
    The “data-key” is just “field_5778e0a4fa700”

  • Is there a fix for this yet? I’ve tried updating to 5.4.2 and using all the fixes here but no luck

  • Hi,

    I have same issue with ACF not pro
    I get the error MissingKeyMapError
    I saw the suggestion to edit/wp-content/plugins/advanced-custom-fields/js/input.min.js
    but cannot find the text to be replaced

    please advise
    Thanks

  • @roflman79 @jaddess
    did you try what I did to make it work?

    Google Api:

    Edit: after activating “Google Maps Geolocation API” and reloading the backend it seems to enable the address field search.

  • The APIs are activated.
    I can’t figure out how to tell ACF what my API key is.

  • Thanks for the link to the documentation but the ACF plugin does not have a functions.php file in which to place the code

  • Have you ever worked with WordPress and themes?
    Every theme got it’s function.php which you need to update.

    https://codex.wordpress.org/Functions_File_Explained

  • Many thanks, I did some reading and now it works 🙂

    Now I am having difficulty getting custom fields to display in posts.
    I looked at the documentation and tried various examples of how to do it, but I suspect I am placing the PHP code in the wrong file – can you point me in the right direction?

    Thanks

Viewing 25 posts - 26 through 50 (of 64 total)

The topic ‘Google Maps field needs setting to add API key’ is closed to new replies.