Get a Google Maps API key
A theme’s Google Maps module loads the Maps JavaScript API, and Google only serves that API with a valid key. Without one, the map shows a grey box or a “This page can’t load Google Maps correctly” message.
If you only need to show one location, a plain embed needs no key. See embedding a Google map.
Before you start
Section titled “Before you start”You need a Google account and a payment method. Google has required billing on every Maps project since 2018. Each month includes free usage, and a typical business site with one contact-page map stays well inside it. Check the current free limits on Google’s pricing page.
Create the key
Section titled “Create the key”- Open the Google Cloud console and sign in.
- Use the project picker at the top to create a new project, or select an existing one.
- Open Billing and link a billing account to the project.
- Open APIs & Services → Library. Search for Maps JavaScript API and click Enable.
- If your map uses a street address instead of coordinates, also enable Geocoding API.
- Open APIs & Services → Credentials, click Create credentials, and choose API key.
- Copy the key that appears.
Restrict the key
Section titled “Restrict the key”An unrestricted key can be copied from your page source and used on other sites at your cost. Restrict it before you use it.
- On the Credentials page, click the new key to edit it.
- Under Application restrictions, choose Websites.
- Add your domain as a referrer, for example
example.com/*and*.example.com/*. Add your staging domain too if you test there. - Under API restrictions, choose Restrict key and select only the APIs you enabled.
- Click Save. Changes can take a few minutes to apply.
Consider setting a budget alert under Billing → Budgets & alerts so unexpected usage reaches you by email.
Add the key to the theme
Section titled “Add the key to the theme”In RT-Themes classic themes, the API key field is in the Customizer under General Options → Google Maps; RT-Theme 18 keeps it on its General Options admin page instead. Where the key goes in RT-Themes themes links the page for your theme. Paste the key, click Publish (or Save), and reload a page that contains a map.
Where the key goes in RT-Themes themes
Section titled “Where the key goes in RT-Themes themes”- Ava: Customize › General Options › Google Maps
- BusinessLounge: Customize › General Options › Google Maps
- Nixe: Customize › General Options › Google Maps
- NaturaLife: Customize › General Options › Google Maps
- RT-Theme 18: RT-Theme 18 › General Options, an admin page, not the Customizer
- RT-Theme 19: Customize › General Options › Google Maps
- RT-Theme 20: Customize › General Options › Google Maps
Check the result
Section titled “Check the result”Open the page while logged out. If the map still fails, open the browser console. Google reports the cause there, for example RefererNotAllowedMapError when the domain is missing from the restrictions, or ApiNotActivatedMapError when an API is not enabled.