Title: Add Google Maps API key filter
Last modified: February 6, 2018

---

# Add Google Maps API key filter

 *  [strarsis](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/add-google-maps-api-key-filter/)
 * It would be nice if this plugin can retrieve a Google API key either by filter
   or from a PHP constant/environment variable (e.g. `GOOGLE_API_KEY`).
    This makes
   re-using the same Google Maps API key much easier.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [supsystic](https://wordpress.org/support/users/supsysticcom/)
 * (@supsysticcom)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/add-google-maps-api-key-filter/#post-9965833)
 * Hi [@strarsis](https://wordpress.org/support/users/strarsis/).
 * We can rewrite API key for Google Maps Easy plugin using hooks.
    If this solution
   is acceptable for you, let us know and we’ll give you required code for this 
   option.
 *  Thread Starter [strarsis](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/add-google-maps-api-key-filter/#post-9966888)
 * [@supsystic](https://wordpress.org/support/users/supsystic/): Yes, this would
   work for me.
 *  Plugin Author [supsystic](https://wordpress.org/support/users/supsysticcom/)
 * (@supsysticcom)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/add-google-maps-api-key-filter/#post-10127034)
 * Hi,@strarsis.
 * We’ve already added such possibility to our plugin. You should hang up the handler
   to the filter “gmp_gRewriteApiKey”:
    `add_filter ('gmp_gRewriteApiKey', array(
   $ this, 'rewriteApiKey'));` where `rewriteApiKey` is the name of the function
   that will return required key to the API key.
 * Let me know, if you have additional questions.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add Google Maps API key filter’ is closed to new replies.

 * ![](https://ps.w.org/google-maps-easy/assets/icon-256x256.png?rev=1086633)
 * [Easy Google Maps](https://wordpress.org/plugins/google-maps-easy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-maps-easy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-maps-easy/)
 * [Active Topics](https://wordpress.org/support/plugin/google-maps-easy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-maps-easy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-maps-easy/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [api key](https://wordpress.org/support/topic-tag/api-key/)
 * [constant](https://wordpress.org/support/topic-tag/constant/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [google maps api](https://wordpress.org/support/topic-tag/google-maps-api/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [key](https://wordpress.org/support/topic-tag/key/)

 * 3 replies
 * 2 participants
 * Last reply from: [supsystic](https://wordpress.org/support/users/supsysticcom/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/add-google-maps-api-key-filter/#post-10127034)
 * Status: not a support question