Skip Navigation

[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, 11 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 11 replies, has 2 voices.

Last updated by ABSTRACTUS 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#605755
Bildschirmfoto 2018-01-12 um 13.32.15.png

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?

Thank you!

#605806

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

Would you mind providing me with admin access to the website so that I can have a further look at this for you ?

The private fields will be enabled for your next response.

Thanks,
Shane

#605866

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for the credentials, however when I tried them they don't seem to work.

Could you check on them and let me know, also please send me a link to one of the posts that the maps are not working.

Thanks,
Shane

#605869

I just checked and realized I had a typo mistake – sorry! wp-admin access should work as by the credentials provided now

#605879

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thanks for the updating the info.

I tried taking a look at this for you and when i created a new post the map works fine.

Could you try re-creating the items that are not working correctly and see if that helps ?

Thanks,
Shane

#606111
Bildschirmfoto 2018-01-14 um 22.41.27.png

Hi Shane

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.

Nothing changed.

#606429

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

It appears the issue is with the API key as i've entered an API key that I have and the maps started showing up fine.

Could you test this on your end and let me know if everything is ok ?

Thanks,
Shane

#606511

Hello Shane,
Thank you for your hint.

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, Claudius

#606514

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

From the google api example it should be *.artagenda.com/* I'm not too sure as to the difference but I know that the format has to be exact.

The only issue with not restricting the API is that someone could use it and cause issues with the free quota that google maps allowed.

Personally I use the domains unrestricted and i have yet to encounter such an issue.

Thanks,
Shane

#606565
Bildschirmfoto 2018-01-15 um 21.46.36.png
Bildschirmfoto 2018-01-15 um 21.50.19.png

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??

#606767

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Claudius,

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.

Thanks,
Shane

#610449

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…