Title: API Key not saved
Last modified: December 27, 2016

---

# API Key not saved

 *  Resolved [AMX](https://wordpress.org/support/users/lightscapes/)
 * (@lightscapes)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/)
 * Every several page loads I get an error message: “Oops! Something went wrong.
   
   This page didn’t load Google Maps correctly. See the JavaScript console for technical
   details.”
 * So, I checked the console and it reads:
 * “You have exceeded your daily request quota for this API. We recommend enabling
   billing to get a higher quota: ” But I am sure I am not getting 25,000 loads 
   daily. No way.
 * The console also shows an API Key and it is not mine and definitely not the one
   I entered in options. My API key works with maps in Avada Theme.
 * The one that the console shows:
 * “js?libraries=places%2Cgeometry&v=3.exp&key=……………X3t7z-9IOOjis&ver=13f264a8833d…:
   2 You have exceeded your daily request quota for this API. We recommend enabling
   billing to get a higher quota”
 * this API key is also found in the plugin’s wd-google-maps/google-maps-setup.php
   file, so it seems my API key is not saved where it should be saved, even though
   it looks like saved in plugin’s options.
 * It seems I am using your default API key, sometimes the map will load, sometimes
   the quota will be exceeded.
 * Please help, otherwise I like the plugins functionality but if it doesn’t work
   I will have to install an alternative.
    -  This topic was modified 9 years, 5 months ago by [AMX](https://wordpress.org/support/users/lightscapes/).

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

 *  [Sona](https://wordpress.org/support/users/support-web-dorado/)
 * (@support-web-dorado)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8596615)
 * [@lightscapes](https://wordpress.org/support/users/lightscapes/),
 * You might be using maps both with theme and the plugin causing the mentioned 
   issue. Could you please contact using the [form](https://web-dorado.com/support/contact-us.html)?
 *  [mshihinski](https://wordpress.org/support/users/mshihinski/)
 * (@mshihinski)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8623939)
 * The issue is within the function gmwd_get_option
 * `if($page == "markers_gmwd" || $page == "circles_gmwd" || $page == "maps_gmwd"
   || $page == "polygons_gmwd" || $page == "polylines_gmwd" || $page == "rectangles_gmwd"
   || $page == "markercategories_gmwd" || $page == "themes_gmwd" || $page == "options_gmwd"
   || $page == "uninstal_gmwd"){`
 * This is preventing the plugin from pulling the API KEY properly on the frontend.
   The API KEY becomes “false” causing the plugin to load from 4 random Google API
   keys that are over quota limits.
    -  This reply was modified 9 years, 5 months ago by [mshihinski](https://wordpress.org/support/users/mshihinski/).
      Reason: typos
 *  [Sona](https://wordpress.org/support/users/support-web-dorado/)
 * (@support-web-dorado)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8629560)
 * [@mshihinski](https://wordpress.org/support/users/mshihinski/),
 * Those 4 keys are all default keys coming with the plugin. The user should generate
   his/her own key for the website and use it instead. The stated function allows
   randomly using one of the existing keys before providing your own, not to keep
   them. Thanks.
 *  [mshihinski](https://wordpress.org/support/users/mshihinski/)
 * (@mshihinski)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8629980)
 * [@support-web-dorado](https://wordpress.org/support/users/support-web-dorado/)
 * If you review your plugin’s code that I referenced previously, you will see that
   even if a user has a saved API key, it is not used. The code above prevents the
   API key from being pulled out of the database. A value of false is always pulled
   from the gmwd_get_option function in your plugin. This causes the plugin to always
   use the random API keys instead of the saved API key in the database. The issue
   is new.
    -  This reply was modified 9 years, 5 months ago by [mshihinski](https://wordpress.org/support/users/mshihinski/).
    -  This reply was modified 9 years, 5 months ago by [mshihinski](https://wordpress.org/support/users/mshihinski/).
 *  Thread Starter [AMX](https://wordpress.org/support/users/lightscapes/)
 * (@lightscapes)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8631993)
 * I deleted the API key from the map in Avada theme and deactivated other map plugins.
   It didn’t help.
 * I installed another map plugin and it seems to work without issues for now.
    
   I liked your plugin and its interface, but I can’t spend much time troubleshooting
   maps.
 * I am not a developer, but I don’t understand the point of having those provided
   API keys in the plugin code. Every webmaster should get their own API key from
   Google. Other solutions cannot work and will not work after the quota is exceeded,
   so why even bother with those default keys? Webmaster’s own key must be saved
   and then pulled, and that is all.
 *  [mshihinski](https://wordpress.org/support/users/mshihinski/)
 * (@mshihinski)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8634161)
 * [@support-web-dorado](https://wordpress.org/support/users/support-web-dorado/)
 * More information is provided for this issue below:
 * Until the framework/functions.php file is fixed, this plugin will not work.
 * Original code:
 *     ```
       function gmwd_get_option($option_name){
           global $wpdb;
       	$page = isset($_GET["page"]) ? $_GET["page"] : "";
   
       	if($page == "markers_gmwd" || $page == "circles_gmwd" || $page == "maps_gmwd"  || $page == "polygons_gmwd" || $page == "polylines_gmwd" || $page == "rectangles_gmwd" || $page == "markercategories_gmwd" || $page == "themes_gmwd" || $page == "options_gmwd" || $page == "uninstal_gmwd"){
       		$query = "SELECT * FROM ". $wpdb->prefix . "gmwd_options ";
       		$rows = $wpdb->get_results($query);	
   
       		$options = new stdClass();
       		foreach ($rows as $row) {
       			$name = $row->name;
       			$value = $row->value !== "" ? $row->value : $row->default_value;
       			$options->$name = $value;
       		}
   
       		return $options->$option_name;
       	}
       	return false;
       }
       ```
   
 * Updated code:
 *     ```
       function gmwd_get_option($option_name){
           global $wpdb;
   
           $query = "SELECT * FROM ". $wpdb->prefix . "gmwd_options ";
           $rows = $wpdb->get_results($query);	
   
           $options = new stdClass();
           foreach ($rows as $row) {
               $name = $row->name;
               $value = $row->value !== "" ? $row->value : $row->default_value;
               $options->$name = $value;
           }
   
           return $options->$option_name;
       }
       ```
   
 * I have applied this patch to my websites using this plugin and the the maps now
   work without displaying the over quota error message in the JavaScript console.
   By limiting the gmwd_get_option function to only return results for the admin
   sections of the plugin, you are preventing the frontend display from pulling 
   the user saved API key.
 *  [mernion](https://wordpress.org/support/users/mernion/)
 * (@mernion)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8635970)
 * [@mshihinski](https://wordpress.org/support/users/mshihinski/) Thank you very
   much for the fix.. It seems that their support is sleeping while thousand of 
   people using their plugin struggle to find out why this is not working… If I 
   didn’t need their plugin so much, i would have already uninstalled it.. But I
   will leave the proper feedback 😉
    Thanks again!
 *  [Sona](https://wordpress.org/support/users/support-web-dorado/)
 * (@support-web-dorado)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8637727)
 * Dear users,
 * The issue is present only with the last update, we have prepared and will today
   release an update which fixes the issue. Thanks for your understanding.
 *  [mernion](https://wordpress.org/support/users/mernion/)
 * (@mernion)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8637896)
 * Yes but it took you soooo long to recognize the problem and respond to it that
   is not acceptable.. At least it will be solved!
 *  [mshihinski](https://wordpress.org/support/users/mshihinski/)
 * (@mshihinski)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8638591)
 * [@mernion](https://wordpress.org/support/users/mernion/)
 * You’re welcome.

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

The topic ‘API Key not saved’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wd-google-maps_9eaba3.svg)
 * [10Web Map Builder for Google Maps](https://wordpress.org/plugins/wd-google-maps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wd-google-maps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wd-google-maps/)
 * [Active Topics](https://wordpress.org/support/plugin/wd-google-maps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wd-google-maps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wd-google-maps/reviews/)

## Tags

 * [api key](https://wordpress.org/support/topic-tag/api-key/)

 * 10 replies
 * 4 participants
 * Last reply from: [mshihinski](https://wordpress.org/support/users/mshihinski/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/api-key-not-saved/#post-8638591)
 * Status: resolved