Google Maps stopped working
If Google Maps is no longer visible on your WordPress website, this is probably caused by the Google policy changes. This change may have caused Google Maps to stop working on your WordPress website. If you’re using a Google service (such as Google Maps) on your website, Google decided they want you to link these to your Google account by using a so-called Google Maps API key. In this article, we explain how you can get and install this API key for Google Maps, so you can get Google Maps working again on your WordPress website.
How does the Google Maps API work?
When you’re showing a map from Google Maps on a page of your website, a connection is made with the Google Maps API at every visit. It is a free service from Google that builds up this map for you, so it loads quickly. Excessive use of this tool costs Google a lot of money, because their servers have to make calculations every single time.
That is why Google is now limiting the use of the API. A connection can be made with the Google Maps API up to 25.000 times a day. When you exceed this limit, you have to pay. Most of the websites will never exceed this limit, so for most people, this service will remain free. You do, however, have to enter an API key on your website, so Google can keep score of the times your website is making a connection with the Google Maps API.
Getting a Google Maps API key
- Go to the Google Maps Developers page.
- Click the blue button ‘Get a key’.
- Login with your Google account (if you are not yet logged in). It’s best to login with the same account as the one you’re using for example for Google Analytics.
- Select ‘Create a project’.
- Click ‘Continue’.
- Wait until you are led to the next screen. This can take several minutes, so don’t close the window and don’t click away while waiting. The next page will open automatically.
- Enter a clear description, under ‘Name’, e.g.: Google Maps for yourdomainname.nl.
- Enter the domain name for which you want to use the API key, under ‘Accept requests from these HTTP referrers’. Enter it like this: *.yourdomainname.nl.
- Enter any other domain names in the same way, if applicable.
- Click ‘Create’.
- You now see a screen with your API key. Copy the key and save this in a safe place.
Installing the Google Maps API key on your WordPress website (easy)
Make sure WordPress, your plugins and the theme on your website are up to date. Check which WordPress plugins and themes show the maps from Google Maps. Check their settings to make sure you can now paste your Google Maps API key. If not, you can contact your plugin or theme developer, because they should fix this immediately for all their users.
Paste the API key in the option field and save the changes. In the example on the right, you see how you can install the Google Maps API key for the newest version of the WordPress theme Enfold.
Installing the Google Maps API key on your WordPress website (advanced)
Does your website run a customized version of Google Maps, or does your plugin or theme no longer get support? Then find an alternative plugin, because using unmaintained code leads to serious safety risks for your website. In the meantime, you can take these steps temporarily – provided you know how to use an FTP program and a code editor:
- With your FTP program, go to the folder of the plugin or theme that’s using Google Maps.
- Download the folder to your computer and search through all the files in the folder for “maps.googleapis.com”.
- Open the files (one or more) that show up in your code editor with this search term.
- Scroll to the place/places with “maps.googleapis.com”. You will probably see a longer address, like “https://maps.googleapis.com/maps/api/js?callback=initMap”.
- Check whether you see a question mark in the URL. In that case, paste the following, directly after the URL: &key=YOUR_API_KEY
- When there is no question mark in the URL, paste the following directly after the URL: ?key=YOUR_API_KEY
- Replace YOUR_API_KEY with the API key you got from Google.
- Save the files and upload them with FTP back to your website.