Google maps appears when published but not in the Pro Content workspace

Hi,

I have Google maps setup with an API key.

Code is resident in the functions.php

function my_add_google_maps_api_key() {
wp_enqueue_script( ‘x-google-map’, ‘https://maps.googleapis.com/maps/api/js?key=AIzaSyDJhEicZvfnoYmoWwHkXswE2KO2sqINlwM’ );
}
add_action( ‘wp_enqueue_scripts’, ‘my_add_google_maps_api_key’, 100 );

the map appears OK when published, but does not appear in the workspace… hence I’m unable to edit it.

I have tested it with two different elements across two content layouts.

Please advise.

Hi,

No need to add that code in your child theme’s functions.php file.

You can add your api on the map element instead

See screenshot below

Thanks…

But I have done that already.

The code is no longer in functions.php file.

The map publishes OK but does not appear in the element preview when I’m working on it.

Hello @himoud,

Thanks for updating the thread. :slight_smile:

I can confirm that the maps on frontend is loading fine. Can you please share website login details (username/password) for us to take a closer look into the backend?

Thanks.

Thank you… add in secure note.

Hi there,

That is correct. The map is not showing on the editor as the whole editor is loading the content using iFrame and as the Google Map is also using the iFrame it is not possible to show a preview while in the editor. But that should not have any effect setting the options on the left panel. You can still change the items there, save the page and check the result in the front end of the website.

This will be the case in the future for most of the elements that use the external Javascript methods that are not compatible with the editor. For more information:

Thank you for your understanding.

OK, thank you for the explanation.

Much appreciated.