More fixes

Google Map not showing on your website

The map on a contact page tells a customer where to go, and it fails quietly: a grey box, a box that says "This page can't load Google Maps correctly", a dark map stamped "For development purposes only", or nothing at all. There are six usual causes, and the first question settles most of them: is the map a plain Google embed, or does it need an API key? A plain embed is free and needs no key, so it is often the quickest fix of all. Below is a rebuilt example (not a real client), how to tell which cause you have, and the fix for each.

The contact page

What the checks found


  

First: which kind of map is it?

  1. Look at what the box says. "This page can't load Google Maps correctly. Do you own this website?" or a dark map with "For development purposes only" means the map uses Google's Maps JavaScript API and the API key behind it has a problem. A grey or empty box with no message is usually one of the other four causes below.
  2. Read the exact reason. In Chrome, right-click the page, choose Inspect, then the Console tab, and reload. A key problem prints a line such as Google Maps JavaScript API error: BillingNotEnabledMapError; the name after "error:" is in the table below.
  3. Find where the map comes from. A map plugin (WP Go Maps, MapPress, a store-locator plugin) or a theme's "Google Maps" setting usually asks for a key. Elementor's Google Maps widget, Divi's map module with an address only, and a pasted <iframe src="https://www.google.com/maps/embed?..."> are embeds and need no key.

The fastest fix for a single location: use the free embed

If all the map has to do is show where you are, you do not need an API key, a Google Cloud account or billing at all.

  1. Open Google Maps, search for your business by name (so the pin shows your listing, reviews and directions button), click Share, then Embed a map, and Copy HTML.
  2. In WordPress, add a Custom HTML block where the map goes and paste it there. Not into the Paragraph block or the Classic editor's Visual tab: those strip or mangle the <iframe>. In Elementor use the HTML widget, or the Google Maps widget with your address. Wix, Squarespace and Shopify each have an embed or map block that takes the same code.
  3. To make it fit phones, change width="600" in the pasted code to width="100%" and keep the height.

If the map needs an API key: the errors and their fixes

Store locators, maps with many pins, and themes with a key field need the Maps JavaScript API. Every fix below is in the Google Cloud console (console.cloud.google.com) under the project that owns the key; if nobody remembers whose Google account that is, it is often quicker to make a new project and key under the business's own account.

Console errorWhat it meansWhat to do
MissingKeyMapError / InvalidKeyMapErrorNo key was sent, or the key was deleted or mistypedCreate a key (APIs & Services > Credentials > Create credentials > API key) and paste it into the plugin or theme setting
BillingNotEnabledMapErrorThe project has no billing account, so Google stops the map; this is also what puts "For development purposes only" on itLink a billing account to the project (Billing in the console). Google gives a monthly free allowance that a small business's contact-page map normally stays inside; set a budget alert so you hear about any change
ApiNotActivatedMapErrorThe key exists but the Maps JavaScript API is not switched on for its projectAPIs & Services > Library > Maps JavaScript API > Enable. A store locator or an address search box may also need the Geocoding API or Places API; the plugin's settings page says which
RefererNotAllowedMapErrorThe key is restricted to a list of websites and yours is not on it, very often after a domain change or a move from www to non-wwwEdit the key's "Website restrictions" to include both https://yourbusiness.com/* and https://www.yourbusiness.com/* (and a staging address if you use one)
ApiTargetBlockedMapErrorThe key's "API restrictions" do not include the Maps JavaScript APIEdit the key and tick Maps JavaScript API (and the others the plugin needs) under API restrictions
ExpiredKeyMapErrorThe key was deleted or replacedMake a new key and update the plugin setting

Do keep the website restriction on. A key with no restriction can be copied out of your page source and used on other sites at your expense.

A grey or empty box with no error

What not to do

For most small sites this is a five-minute swap to the free embed, or one setting in the Google Cloud console. If you would rather hand it over, or the map comes from a store locator with many locations, that is what the box below is for. Related: changes not showing (a cache serving the old page after the fix), an older site that shrinks on phones, and a slow site.