As of version 4.2.1, The Events Calendar allows you to enter your Google Maps API key to help avoid map timeouts and API error messages. This should be especially helpful for sites with a lot of traffic.
The Google Maps API Key is used for the following features:
- Venue location maps on single events
- Maps on single venues
- Events Calendar Pro’s Map View
It is not used for the following features:
- Retrieving the latitude and longitude from a Venue’s address
- Filter Bar‘s location-based searches
Obtaining an API Key
At the above URL, click the “Get a Key” button and create a “project”. Give the project a descriptive name—it’s mainly just for your own reference, but a simple and descriptive name works best regardless.
Entering and Testing Your API Key
Once you obtain one of the aforementioned browser keys, you can enter it in your wp-admin settings for The Events Calendar. You’ll find the relevant settings in the Events → Settings → APIs tab.
An easy way to tell if your API key is not being used at all (e.g. you never entered one in the settings) is looking at your site’s console for a message like this:
After entering your API key in the settings, you should no longer see this yellow warning message in your site’s console.
Note that the API may send other messages to your console, such as API Not Enabled or Key Over Limit, and these console messages are not from our plugin.
Pro tip: If your APIs tab is not visible, it is possible that your site is part of multi-site network.
Under Network > Settings > Events Settings, there’s an option to hide tabs on different sites.
We recommend contacting your WordPress network admin to fix this issue.
Using Your API Key
We highly recommend following Google’s best practices for securely using API keys.
Possibly the easiest and most effective action you can take is restricting your API keys to specific referrers (i.e. web sites).
When generating your API key, you should whitelist your domain(s) so owners of other domains cannot steal your API key’s usage.
We recommend that you include two urls like this (thanks alphagod1 for the tip):
(notice with and without preceding dot)
- If your site is https://example.com/ (“naked” domain without www), you should enter example.com/*
- If your site is https://www.example.com/ (non-www always redirects to www) or http://wp.example.com/ (subdomain), you should enter *.example.com/*
- If your site is https://example.dev/ (localhost development via DesktopServer), you should enter example.dev/*
⚠️ Please note: The asterisks used in these example URLs are intentional and important! They are wildcards that do not match “nothing”, which is why *.example.com/* will not work for https://example.com/. You can also add multiple rules to a single API key, if needed.