Google map embed not working

I am adding a map to a website but I’m having some trouble, can someone help?

I used Google map, added the API key, the longitude and latitude but it’s not displaying.

I used the classic element as I thought that I just had a problem with the V2 but it still doesn’t work.

The error talks about a JavaScrip console, I am no developer just a designer so I am a bit lost on this one.

Hello @Kenza,

Thanks for asking. :slight_smile:

If you have added the API key and still maps is not getting displayed then please make sure that you have activated the API. Please take a look at following article for more information. Kindly scroll down to the section that starts with Google Maps JavaScript API Error Codes for Developers:

https://developers.google.com/maps/documentation/javascript/error-messages

If you have issues, please share website URL for us to take a closer look.

Thanks.

Hi @Prasant,

The API key looks activated from what I can see.

I have been looking at the link you sent but don’t find which error I fit in. Also, the map load at first and then I see the error message, looks weird.

Hi,

It looks like you haven’t activated the API as I see Google Maps API error: ApiNotActivatedMapError in browser console. Please take a look at following article for more information. Kindly scroll down to the section that starts with Google Maps JavaScript API Error Codes for Developers:

https://developers.google.com/maps/documentation/javascript/error-messages2

Thanks.

1 Like

Thanks @paul.r

I got the client to look into that.

Hi There,

You can also add the following code into your child theme’s functions.php file and test your Map.

function my_add_google_maps_api_key() {
  wp_enqueue_script( 'x-google-map', 'https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE' );
}
add_action( 'wp_enqueue_scripts', 'my_add_google_maps_api_key', 100 );

Replace YOUR_KEY_HERE with your Google API Key.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.