Knowledge base / WordPress

Divi Map module not working: how to fix it

Divi's Map and Fullwidth Map modules use the Google Maps JavaScript API, so they need your own key. Elegant Themes' help says the module needs a valid Google API key to work at all. Most broken Divi maps come down to that key, the two APIs behind it, or a second plugin loading Google Maps on the same page.

How Divi loads the map

Divi stores one key for the whole site under Divi → Theme Options → General, in the Google API Key field. Older Divi versions label the field Google API or Google Maps API. The Map module has a Change API Key button that takes you to the same field.

Divi then adds the Maps JavaScript API script to pages built with the Divi Builder. A toggle on the same screen, Enqueue Google Maps Script, controls this. Elegant Themes' help says map modules stay in the builder but stop working while it's off, unless you add the script yourself.

Divi's help asks for two APIs on the key's project: the Maps JavaScript API to draw the map, and the Geocoding API to turn your pin addresses into coordinates.

How to tell what's wrong

  • Grey box with “Oops! Something went wrong.”: Google rejected the key. The console names the reason.
  • “This page can't load Google Maps correctly.” dialog: usually billing or a key restriction.
  • Empty space where the map should be, no Google error: the script isn't loading at all. Check the Enqueue toggle, a consent plugin and any script optimisation.
  • Map draws but pins are missing or in the wrong place: the Geocoding API isn't enabled or allowed for the key.
  • Map works on some pages and not others: another plugin loads Google Maps on those pages too.

Open the page, press F12 and look at the Console tab. Typical Divi failures look like this:

Google Maps JavaScript API error: ApiNotActivatedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#api-not-activated-map-error
You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.

Why it happens

  • The key field is empty or stale. Common after a site migration, a fresh Divi install, or importing a layout from another site. You'll see MissingKeyMapError or InvalidKeyMapError.
  • A stray space in the key. Divi's help specifically warns against spaces at the start or end of the pasted key.
  • An API isn't enabled. Maps JavaScript API missing gives ApiNotActivatedMapError. Geocoding API missing breaks the pins.
  • Referrer restrictions don't match your domain. Divi's help notes the key may not work if the allowed referrer doesn't match your site's domain. The console shows RefererNotAllowedMapError.
  • No billing account. Divi's help is clear that Google requires a valid payment method. Without one you get BillingNotEnabledMapError.
  • Two loaders. A store locator, a form plugin with address autocomplete, or another maps plugin loads the API as well as Divi.
  • The script is held back. A consent plugin blocks Google scripts until the visitor agrees, or an optimisation setting delays or combines scripts so the map code runs before Google's.

The fix, step by step

  1. 01In WordPress admin, open Divi → Theme Options, stay on the General tab and find Google API Key. Copy the value.
  2. 02Make sure Enqueue Google Maps Script is on, unless you've deliberately turned it off because another plugin loads the API (see below).
  3. 03In Google Cloud Console, open the project that owns the key. Under APIs & Services, enable Maps JavaScript API and Geocoding API.
  4. 04Open the key under Credentials. If it has API restrictions, add both APIs to its allowed list. Enabling them on the project isn't enough on its own.
  5. 05Under the key's website restrictions, add your domain with a wildcard path. Divi's help gives patterns in the form *example.com and *example.com/*. Use your own domain.
  6. 06In Billing, confirm the project has an active billing account.
  7. 07Paste the key back into Google API Key with nothing before or after it, and click Save Changes.
  8. 08Open each page with a map in the Divi Builder and check the pin address. Re-enter it if the pin was placed while geocoding was failing. Save.
  9. 09Clear your caching plugin and any CDN cache, then reload in a private window. Divi's help says settings can take up to five minutes to apply.
Per-module keys

Divi modules inherit the Theme Options key, but older guides from Elegant Themes describe replacing it for an individual module. If one page fails while others work, open that page's Map module and check whether it carries its own key. See where page builders store the key.

If another plugin also loads Google Maps

Two loaders on one page cause the multiple-times warning, and the second key often has different restrictions. Map behaviour then depends on which script wins.

  1. 01View the page source and search for maps/api/js. Note how many times it appears and the key= value in each.
  2. 02Find which plugin owns each one. The duplicate loader guide explains how.
  3. 03Best option: keep Divi's loader and stop the other plugin loading its own, if it has a setting for that. Make sure both use the same key.
  4. 04Alternative: turn off Enqueue Google Maps Script in Divi and let the other plugin load the API. Only do this if that loader includes your key and loads on every page that has a Divi map, otherwise Divi's maps stop working.

Consent and optimisation plugins

Test in a private window without touching the cookie banner. If the map only appears after consent, the consent plugin is blocking Google Maps. Decide whether the map can load before consent, and make sure the placeholder explains how to show it.

If the console shows google is not defined, scripts are running out of order. Exclude maps.googleapis.com from script delay, defer and combine options in your optimisation plugin, then test again.

Confirm it is fixed

Reload every page with a Divi map in a private window, with the console open. There should be no Google Maps errors and no multiple-times warning, and the pins should sit where you expect. Then run a scan on each map page. It loads the page as a first-time visitor and lists every Maps loader and console error, so a second plugin loader or a per-module key shows up on the page that has it.

Common questions

Where do I put the Google Maps API key in Divi?

Divi → Theme Options → General tab, in the Google API Key field. Older versions call it Google API or Google Maps API. Click Save Changes afterwards.

Which APIs does the Divi Map module need?

Elegant Themes' help lists the Maps JavaScript API and the Geocoding API. Enable both on the key's project, and add both to the key's API restrictions if it has any.

What does Enqueue Google Maps Script do in Divi?

It controls whether Divi adds the Google Maps script to Divi Builder pages. Turning it off can help when another plugin already loads the API, but Divi's map modules stop working unless something else loads the script with your key.

Why is my Divi map pin in the wrong place?

Divi converts the pin address to coordinates with the Geocoding API. If that API wasn't enabled or allowed for the key, re-enable it and re-enter the address in the module.

Check whether this is your error

A scan tells you in about twelve seconds, from a clean session.

Related articles