I need a custom field with a map that defaults to a specific GPS Location when it appears in the backend of posting a bbpress topic. Once it shows up there needs to be the ability for the poster to move the marker to a specific location. When they post it the frontend will show the address, GPS Coordinates, or at least show the marker on the map.
I have a ACF map plugins installed. I have API keys for Here, Mapquest, Google. I have the Leaflet and OpenStreetMaps ACF plugins.
Here is my problem.
A. Google Maps does what I want on the backend perfectly, but on the frontend it only gives coordinates, not a map. I read about some kind of API issue,and that several files need to be edited.
B. I have tried OpenStreetMaps several different ways, but on the backend, the marker will not move even thought it says it can be moved. (plus it has Hamburg germany as the default map.)
C. Leaflet lets you drag the marker put it does not show a map in the backend the frontend.
Help!
This worked for me:
https://www.advancedcustomfields.com/resources/google-map/#requirements
Note: this code crashed my site
function my_acf_google_map_api( $api ){
$api['key'] = 'xxx';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
This code did work:
function my_acf_init() {
acf_update_setting(‘google_api_key’, ‘xxx’);
}
add_action(‘acf/init’, ‘my_acf_init’);
NOTE: When I went to edit the topic that was working all of my custom fields were missing.
They were also gone in the ACF plugin module. (This happened to me before.)
So I created new custom fields and everything seems to be working fine. All I can think is the function code that crashed corrupted the ACF.