[Resolved] Maps Plugin on some posts displays the Google Maps
This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue here is that the user wanted to display his map on the frontend but the map is showing blank on the frontend.
Solution:
This is a common issue and is generally caused by Google not being able to verify the request from your site using a restricted referrer.
To resolve this by the simplest method is to not restrict your API key.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I am trying to: We have a custom post type "Venue" which includes an "Address" Types field called wpcf-geolocation.
Since we updated all plugins last time and switched from http to https, we have issues with the display of some geolocation pins. (before, all pins were displayed correctly)
Link to a page where the issue can be seen:
Map not displaying correctly (examples): hidden link hidden link hidden link
Map displaying correctly (examples): hidden link hidden link
I expected to see: When entering the address in the Dashboard, the pin is always displayed at the correct location. I then save&publish the post. The Content Template uses the wpcf-geolocation field to display a pin on a Google map in the frontend.
Instead, I got: Switching to the frontend display of the venue, on SOME (mainly: older) venue posts the pin is displayed correctly as well, while on others (mainly: newer) venue posts the map shows Google Maps "zero" position (somewhere in the sea, close to Baker Islands). I cannot identify what is different from the posts that work properly vs the ones with the broken map :-(( They all are displaying the pin correctly in the backend…
Do you have any idea why we have this issue, and how to resolve it?
I created a new venue, and the issue is still the same as described before with new entries: in the backend, the map with the pin is displayed correctly. But for the visitor of the website, the map is somewhere in the ocean and there's no pin around.
I created a new API key and added – as by strong recommendation – a restriction, the most simple one:
HTTP referrer: *artagenda.com/*
Result: The issue still persists, no pin displayed for new venues.
Then I removed the restriction on the API key.
Result: It works! Pins are displayed correctly on the venues that had the issue.
So while I am happy that it is working with the API key, I am worrying about the fact that the API key is now completely unrestricted. How do I have to set the restrictions? What is wrong (and wasn't before?) with *artagenda.com/* or *.artagenda.com/* as restriction set? How can I protect the API otherwise?
Thank you. I have tried several versions of the term before… Now I have set restriction to *.artagenda.com/*
The result is:
- Even in the backend, the Maps plugin is not responding, while entering the address there are no proposals displayed, no map is displayed.
- In the frontend, it says "Oops. Maps could not be loaded correctly), and Javascript console says:
Google Maps API error: RefererNotAllowedMapError hidden link
Your site URL to be authorized: hidden link
To be honest, this is even worse than before… It must be somehow possible to enter a correct restriction for the Maps API??
I did some reading on the API key and it seems that the restriction applies to platform restriction. Meaning if you restrict the API key it can only work on the specific platform.
I find their api url authentication very strange in how it works.
It seems the only format that actually works is *artagenda.com/*
Try creating a fresh key and use the restriction as above.
Thank you for your reply. Indeed, as soon as I enter the URL restriction in any thinkable way (including the one you proposed), the maps stop working on the site. So the solution now is to leave API restrictions empty, which seems not recommended by Google (as the API key is displayed with a yellow exclamation mark warning sign), but it seems that this is the only way to go for now…