Google Maps using default API key MB Settings Page with MB Groups
Support › MB Settings Page › Google Maps using default API key MB Settings Page with MB GroupsResolved
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by
Totis-Tautvydas Rakickas.
-
AuthorPosts
-
July 23, 2020 at 3:42 AM #20917
ambrdigital
ParticipantWe are using the MB Settings Page to display our company's contact details, we have multiple locations so we are using the MB Groups extension as well.
The issue we are having is with the Maps field is not using our API key on the frontend, and it is defaulting to the Meta Box generic API key. however, in the WordPress backend, our API key is being used correctly.
We are using the RWMB_Map_Field::render_map() function because it is in a group and everting is outputting correctly. The only issue is the API key set in the Map field is not being used on the front end when registering the maps.google script.
July 23, 2020 at 9:42 AM #20925Long Nguyen
ModeratorHi,
That means you are using a script code on the front end and it has another Google API key? The field Google Map only takes the API key in the field settings base on our design. You can add more libraries via filter
rwmb_google_maps_url. See more in the documentation
https://docs.metabox.io/fields/map/#filters
https://developers.google.com/maps/documentation/javascript/librariesJuly 23, 2020 at 11:43 AM #20928ambrdigital
ParticipantThanks for the replay, I am confident that its a meta box issue because the API Key being outputted is the default that can be found in the meta box plugin. Note we are using the Meta Box AIO version.
meta-box/inc/fields/map.php
'api_key' => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ', on line 108 and again 182.Again I have an active API key in my code everything is working as desired except the API key.
July 23, 2020 at 11:53 AM #20929ambrdigital
ParticipantThe other thing to note when I output the map not using a MB Group our map API key is output correctly.
July 23, 2020 at 4:28 PM #20931Long Nguyen
ModeratorHi,
You can use the second parameter
$argsto pass the API key to the map.$group_values = rwmb_meta( 'group_id' ); $args = array( 'api_key' => 'your-API-key' ); // If group is cloneable foreach ( $group_values as $group_value ) { echo RWMB_Map_Field::render_map( $group_value['map_id'], $args ); }Let me know how it goes.
July 23, 2020 at 11:06 PM #20942ambrdigital
ParticipantPerfect, that solved it. thanks again for your help, much appreciated.
December 3, 2020 at 5:40 PM #23405Totis-Tautvydas Rakickas
ParticipantThat solved my issue after creating multiple billing accounts and it took me few days to end up in this post , this should be included in Plugins main info in RED marking lol.
-
AuthorPosts
- You must be logged in to reply to this topic.