Home › Forums › Backend Issues (wp-admin) › Google Maps field needs setting to add API key › Reply To: Google Maps field needs setting to add API key
Google Maps worked fine in the backend on my local dev setup, but when I pushed it to staging, the API reports “Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys” in DevTools console.
I have tried many of the solutions above, but ended up with this in functions.php of my theme, which seems to be the recommended way:
// Setting the Google Maps API key for ACF
function bmhe_acf_init() {
acf_update_setting(‘google_api_key’, ‘MY_API_KEY’);
}
add_action( ‘acf/init’, ‘bmhe_acf_init’ );
Can somebody tell me why Google isn’t getting this API?
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.