Knowledge base / WordPress

WPBakery Google Maps not working: how to fix it

WPBakery's own Google Maps element doesn't ask for an API key. Older versions take a pasted embed iframe, and since version 8.3 it takes a location. Many WPBakery sites also run a theme or add-on map element that uses the Maps JavaScript API with its own key, and that's usually the one that breaks.

Which map element do you have?

WPBakery sites can have three quite different things that all look like “the Google Maps element”. Open the page in WPBakery's editor and edit the map to see which.

What you see in the element settingsElementNeeds your key?
A Location field, plus height, zoom and map styleWPBakery Google Maps, version 8.3 and laterNo key field in WPBakery's docs
A Map embed iframe field holding pasted codeWPBakery's older Google Maps element, now in the Deprecated tabOnly if the pasted code uses one
Address, markers, styles and often an API key noticeA theme or add-on map elementYes, usually in the theme or add-on settings

WPBakery replaced its Google Maps element in version 8.3. The new one takes an address or place name in Location, an optional height in pixels, a zoom level from 1 to 20 (10 by default) and a map style of Default, Satellite or Hybrid. The previous element moved to the Deprecated tab of the element library, so existing pages can still use it.

How to tell what's wrong

  • Blank area or a Google message inside a frame: the pasted embed code in a deprecated element is broken or incomplete.
  • The map shows the wrong place: the Location text, or the pasted embed, points somewhere Google interprets differently.
  • Grey box with “Oops! Something went wrong.”: a theme or add-on element using the Maps JavaScript API has a key problem.
  • Map missing for new visitors only: a consent plugin is blocking Google content.
  • Map broke after a theme update: the theme's map element changed, or its key setting was reset.

A theme map element with a key problem logs a clear error in the browser console (F12 → Console):

Google Maps JavaScript API error: MissingKeyMapError
https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error

Fix the deprecated embed iframe element

The older element only displays whatever iframe code you paste in. When it breaks, the code is the problem.

  1. 01Edit the element and look at the Map embed iframe field. It should contain one complete <iframe … src="https://www.google.com/maps/embed?…"></iframe> tag.
  2. 02Check for common damage: a plain Google Maps link instead of iframe code, a missing closing tag, a cut-off src, or two iframes pasted together.
  3. 03If the src contains /maps/embed/v1/ and key=, it's a Maps Embed API iframe and needs a valid key with the Maps Embed API enabled. Otherwise it's a keyless share embed.
  4. 04Generate fresh code. In Google Maps, find the place, choose Share, then the Embed a map tab, and copy the HTML.
  5. 05Paste it into the field, replacing everything that was there, and save or update the page.
  6. 06Better still, swap the deprecated element for the current Google Maps element and enter the address in Location. There's no code to break.

More on fixing old embeds is in replacing a broken iframe embed.

Fix the current Google Maps element

  1. 01Edit the element and check the Location field. Type the same text into Google Maps. If Google lands somewhere else, use a fuller address or the business name exactly as it appears on Google.
  2. 02Set a height. A map with no usable height can collapse inside a narrow column. See the zero-height container guide.
  3. 03Save, clear your page cache and check the live page in a private window.

Fix a theme or add-on map element

Many commercial themes bundle WPBakery and add their own map element, as do add-on packs. These typically use the Maps JavaScript API, so they need your own key, an active billing account and the right APIs enabled. The key field lives in the theme's options panel or the add-on's settings, not in WPBakery.

  1. 01Note the element's name in the WPBakery editor. That tells you which theme or add-on it belongs to.
  2. 02Find its API key setting in the theme options or the add-on's settings page. Look for a Google Maps or API section. If the field is empty, that explains MissingKeyMapError.
  3. 03Read the console error and fix the matching cause: ApiNotActivatedMapError means enable the API it names, RefererNotAllowedMapError means add your domain to the key's website restrictions, and InvalidKeyMapError means the key is wrong or deleted.
  4. 04Check the project in Cloud Console has an active billing account.
  5. 05Paste the key with no spaces around it, save, and clear caches.
One key, one loader

A theme map element, a maps plugin and a store locator can each load the Maps JavaScript API with a different key. Google then warns “You have included the Google Maps JavaScript API multiple times on this page” and maps fail unpredictably. Search the page source for maps/api/js, and follow the duplicate loader guide to get down to one. Where page builders store the key lists the usual places a key hides.

After a theme update

Theme updates can rename or replace a bundled map element, or reset its settings. If a map broke right after an update, check the theme's changelog for map changes, re-check the key field, and open one page with a map to see whether the element still exists. If it now shows as an unknown shortcode, the element was removed and you need to replace it with the current WPBakery Google Maps element.

Consent plugins

Open the page in a private window without touching the cookie banner. If the map only appears after you accept, the consent plugin is blocking Google content. Check its rules for Google Maps and embedded iframes, and make sure the placeholder tells visitors how to load the map.

Confirm it is fixed

Reload each page with a map in a private window, with the console open. Keyless and Embed API iframes should show the map with no message inside the frame. Theme maps should load with no Google Maps errors. Then run a scan on the page. It loads the page from a clean session and lists the Google Maps requests and console errors it saw, including a second loader you might not know about.

Common questions

Does WPBakery's Google Maps element need an API key?

WPBakery's documentation doesn't mention one for either its current element or the older embed element. A key is only needed if the embed code you pasted uses the Maps Embed API, or if your map comes from a theme or add-on element built on the Maps JavaScript API.

Where did the old WPBakery Google Maps element go?

From version 8.3 the new Location-based element replaced it. The previous version is in the Deprecated tab of the element library, so you can still find it there and edit maps that use it.

Why does my WPBakery map show “Oops! Something went wrong.”?

That message comes from the Maps JavaScript API, which WPBakery's own element doesn't use. Look for a theme or add-on map element and check its API key setting and the browser console error.

Why is my pasted Google Maps embed blank in WPBakery?

The code is usually incomplete or is a plain link rather than iframe code. Generate fresh code from Google Maps with Share and then Embed a map, and replace the field's contents completely.

Check whether this is your error

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

Related articles