Skip to content

oik_set_lang_lng() fails quietly when it gets REQUEST_DENIED from Google Maps #244

@bobbingwide

Description

@bobbingwide
C:\apache\htdocs\wordpress\wp-content\plugins\oik\includes\oik-remote.inc(78:0) bw_remote_get(1) 219 0 
2025-12-28T14:11:05+00:00 11.575864 1.503927 
cf=save_post_course 14095 72 19747<>0 104857600/104857600 256M F=2650 en_GB 1 
https://maps.google.com/maps/api/geocode/json?sensor=false&key=API key with referer restrictions
&address=Milford+Golf+Club+Station+Lane%2C+Milford%2C+Surrey+GU8+5HS

C:\apache\htdocs\wordpress\wp-content\plugins\oik\includes\oik-remote.inc(78:0) bw_remote_get(2) 220 0 
2025-12-28T14:11:05+00:00 11.577555 0.001691 
cf=save_post_course 14095 72 19747<>0 104857600/104857600 256M F=2650 en_GB  
{
   "error_message" : "API keys with referer restrictions cannot be used with this API.",
   "results" : [],
   "status" : "REQUEST_DENIED"

In anchorgolf.com, when I created a new Course for Milford GC, the lat and long weren't being automatically set.
It would appear that this is because I have set referer restrctions on the Google Maps API key.

Workaround

  • Google Maps doesn't like it but one solution is to change the API Key so that it doesn't have any Application restrictions.
  • Another solution is to Add API restrictions to use the Geocoding API.

Proposed solution

I've used the second workaround for anchorgolf.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions