You can use your own Google Maps API Key with The Events Calendar to get more out of your venues and maps.
A Google Maps API key, when used a lot and uncontrolled, can incur costs. In order to have some control over it you can put some restrictions on the key. However that doesn't always play out well.
(You can find detailed information about setting up your Google Maps API Key in this article.)
These two APIs however cannot work with the same restrictions.
The workaround is to use two separate Google Maps API Keys.
Use a different API Key for venue geolocation lookups (Events Calendar PRO) with Geocoding API. This key should select “IP addresses (web servers, cron jobs, etc.)” restriction.
This screenshot should also be helpful in the explanation.
Since there is only one field for the API key in the settings panel you will need some code as well. Paste the following into your child theme's functions.php file, or create a separate plugin from it.
The API key that you use for Geocoding API, put it in the appropriate place in the code.
- The Events Calendar
- The Events Calendar PRO
- Originally written in 2018
- Snippet by Cliff Paulick
- Author: Andras Guseo
As with all of our recipes, please note that we share this in the hope it will be useful but without any guarantees or commitments. If you wish to use it, it is your responsibility to test it first of all and adapt it to your needs (or find someone who can do so on your behalf). We are unable to provide further support in relation to this recipe.