Google Map not working after API Key has restrictions

Hi,

Following the instructions mentioned here, I configured my Google API Key. Unfortunately it does not displays at all front-end, nor is the console showing any warnings. How should I debug this issue further?

Google settings:

Cornerstone:

Hello @dhunink,

We would be happy to double check your site if we can log in. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Hi @ruenel,

thanks for the quick response. I’ve added a Secure Note!

Hey @dhunink,

Could you please update your Pro theme to 6.7.3 version first? This is to make sure that we are using the latest version. Clear the plugin cache before testing the site again. By the way, I can see the map in the backend and I also was able to replicate the issue that it is not showing on the front end.

Thanks.

Hi @ruenel,
Updates have been done. Caching was disabled from the start.

Hi @dhunink,

I have created a new test page with the Google Map and it is working fine. Please delete the sections of the specific page one by one, and if it helps, the last section you deleted might be the reason behind your problem. Also, you can use the test page and add the other content and use it as a new Contact page.

Thanks

I did deleted the existing section with the map in it, created a new section with a new map element, but that doesn’t seem to fix it. Creating an entire new page does not sound like a genuine solution but just a workaround, needing extra work on SEO, redirects etc. That’s not the road to go.

Another observation: you created a draft. Viewing that in preview, seems to work the same as viewing it in Cornerstone. The map is shown indeed. But when you publish that new page, as I just did, the issue is there again: the map is not displayed.

Hi @dhunink,

I was suggesting to use the new page and renamed it to the Contact page, but I checked right now and found that the published page is not showing the Map. I moved the page to Draft again, and surprisingly found that the Map started working again.
It is a really weird issue you are facing. I would suggest you check your Google Cloud account and check if the staging URL is listed in it.

I also tried to deactivate all the plugins to check if any plugin conflict is the reason behind your problem, but unfortunately, the plugin page keeps loading and never renders. I would suggest you deactivate all the plugins and check if that resolves your problem.
I will check with my other team members and also with our development team on this and will inform you if anything is found.

Thanks

Glad to hear you experienced the issue now firsthand.
The Google API restrictions aren’t the main problem here: if it was, then the map also shouldn’t shown when in draft-mode or in the Cornerstone editor. As you can see from the screenshot from my original post, the API restrictions cover all subdomains, so including the staging-subdomain.
So far I havent had any luck fixing the issue by disabling plugins.

The way I see it, this has to do with how the map element is handled when viewed through a logged-in view like Cornerstone Editor or seeing a preview of a draft, which works, or when viewing it in non-preview screens.

Hi @dhunink,

I tried to replicate it in my local environment, and unfortunately, I was unable to find any problem. I will inform our development team and will explain the problem, check, and inform them of anything found.

Thanks

Hi @tristup, do you have any updates in this issue yet?

Hi
I had a similar issue to this and discovered it was the how i had input the web address into the google API restrictions section . I would try removing the :// and just have the * before the domain. The best way to test if it is google causing this issue is to remove the restriction temporarily and see if it fixes the issue. Thats how i narrowed the issue down to it being google. Hope this helps

1 Like

Hi @dhunink,

Regretfully, there is no news till now. I will check with the team and let you know about it. Till then, I would suggest you check the points mentioned by @The_Capture_Factory it might help to narrow down the reason.

Thanks

Hi all,

I finally tracked the cause of the issue down!
First of all a very big thanks to @The_Capture_Factory! Indeed the restrictions on the Google API should be entered as mentioned by him/her, instead of the format described in the documentation. @tristup that might be something to improve?

Secondly: the Complianz plugin, installed on 1+ million WordPress websites, is interacting with the Maps Element as well under curtain conditions.
When the status of the Google Maps rule shown below is toggled ON, the maps element will no longer work. But there also won’t be any output of any error or warning into the developer console, which made this issue hard to track down.

I think there’s room for improvement here, given that this plugin seems to be a rising star and Pro is just, you know, super awesome. I guess that improvement will have to come from Complianz end, and I’m happy to reach out to them. I do want to that with some in-depth information.
Please dor read further after the first screenshot.

When the mentioned toggle is set to on, Complianz promises to show a placeholder. Which it does not do when working with Pro’s Map element. I want to reach out to them and address the issue, hoping they can find a way to place a placeholder inside the map element as well. Can I refer them to any particular information regarding the exact hooks/actions the Map Element taps into, so that they can work with that?

Hey @dhunink,

Thank you for your feedback. The *:// has worked for a long time but we’ll test this and update our docs.

The Complianz plugin developers will want to look at the file pro\wp-content\themes\pro\cornerstone\includes\elements\definitions\map.php

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.