I came across the same issue just now. Turns out that in wp-content\plugins\advanced-custom-fields-pro\includes\fields\class-acf-field-google-map.php the callback
param is set to an empty string:
// vars
$api = array(
'key' => acf_get_setting( 'google_api_key' ),
'client' => acf_get_setting( 'google_api_client' ),
'libraries' => 'places',
'ver' => 3,
'callback' => '',
'language' => acf_get_locale(),
);
Just below this there’s a filter we can use to override these params:
// filter
$api = apply_filters( 'acf/fields/google_map/api', $api );
I found a post on Stack Overflow that suggests setting the callback
param to Function.prototype
, see https://stackoverflow.com/a/75212692
This fix works for me:
add_filter('acf/fields/google_map/api', function ($api) {
$api['callback'] = 'Function.prototype';
return $api;
});
FYI Stefan (and Elliot) the same issue applies to the Gallery field, i.e. it stops working correctly if it’s not the first on the page. In its case it just means the thumbnails aren’t draggable, but the field otherwise works.
See http://support.advancedcustomfields.com/forums/topic/cant-reorder-images-in-gallery/#post-14528
FYI I did some testing and it seems it’s the same problem as here:
http://support.advancedcustomfields.com/forums/topic/google-map-field-frontend-form/
i.e. the Gallery field thumbnails are only draggable if the acf_form displaying the field group containing the gallery field is the first acf_form on the page.
Thanks for this Stefan!
I was just about to post my own report about this after spending a day figuring it out 🙂
I have several acf_form calls on my page, each with different field groups in their options (various popups contain these different forms).
I had originally thought the solution was I was moving the form with the Google Map field using jQuery’s appendTo, because I’d solved it by using wrap instead, but it only worked because it just so happened it was the first form on the page.
Later on when I added another form to a div before that one, things stopped working, and so I thought it was something to do with a JS conflict or whatever. So I created a blank PHP template and only loaded in the acf_form calls and noticed that things only stopped working when the form containing the field group with the Google Map field wasn’t at the top.
So yeah, I solved the problem by moving that hidden popup div containing the map to the very top of my markup 🙂
If only I had come across this page sooner in my searching for a solution!
Just thought I’d explain my problem for anyone else having the same trouble to confirm the issue: if you’re using several acf_form calls on the frontend, ensure the one containing the Google Map is first in your markup otherwise the map canvas will be blank.
Thanks again Stefan!
Thanks for the fix Matthew, I had to remove the if statement like Overbound.
Interesting to note that it’s also a bug for ACF field groups as well! e.g. if you’re on /wp-admin/post-new.php?post_type=acf and hit Publish without first giving the group a name it disables the Publish button.
Elliot: I’ve got version 4.3.8 like rpetersnmt also — the fix doesn’t seem to be in effect. Adding a new field group and hitting Publish is a quick test 🙂
I can confirm this bug, using WordPress 3.9 and ACF 4.3.8 — if there is a required field that you forget to fill out the Publish button is deactivated.
Will check out Matthew’s workaround now, thanks Matthew.
Stew
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.