Add gmp_g Rewrite API Key filter to rewrite Google Map API key

First of all, for correct work of map it’s highly recommended adding your Google Maps API key. You can get it from Google Maps service.

User_API_key

But sometimes, user needs to substitute the main API key or use several keys according to the circumstances.

There is an additional option to substitute the main API key programally which already has been saved in settings. 

The substitution ensues with a help of the gmp_g Rewrite Api Key filter.

Here  is an instruction how to work with a filters in WordPress.

 


For better understanding take an example:

 


 You can add this code into the page or to the another plugin – the main thing is that

add_filter(‘gmp_gRewriteApiKey’, array($this, ‘getCustomGoogleApiKey’))

Function have to be called before the system will request API key. 

Categories
Latest Articles
Get plugins bundle today and save over 80%