Conditionally disable addition of Google Maps API?

New home Forums Basic Version General queries Conditionally disable addition of Google Maps API?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34069
    edash22
    Member

    I am using an additional map plugin (because it has a feature that WP Google Maps lacks). On pages where this other map plugin displays, I am getting a fatal error: included Google Maps API multiple times. I only get this error on pages where the other plugin displays. I do not get the error on pages where I use WP Google Maps. How can I modify the plugin code so that it loads the Google Maps API on certain pages? Turning off the loading of the Google Maps API entirely is not an option.

    #34102

    Hi there,

    Thanks for getting in touch with us.

    WP Google Maps should already only load the Google Maps API on pages where the map is included.

    Could I please ask you to confirm if you have the latest versions installed?

    Kind regards,
    Dylan

    #34113
    edash22
    Member

    Yes, I verified that my plugins are the latest. Here’s what I have:
    WP Google Map Plugin: Version 4.0.2
    WP Google Map Pro: Version 4.0.7

    Both of these are activated. (Initially, I only had the Pro version activated, but that doesn’t seem to make a difference for the API duplication.)

    Thank you,
    e-

    #34116
    edash22
    Member

    One more update to this thread … I added some code to my child’s theme functions.php that dequeues the wpgmp-google-api script when it’s on a page that uses the other map plugin.

    It would be nice if I didn’t have to do this. I’m not sure why the plugin loads stuff onto a page when it’s not needed.

    #34137

    Hi Edash,

    Sorry for the delay in response over the weekend.

    WP Google Maps does not load the API on pages where the map is not added in the latest releases.

    It seems like you are using a different plugin, as our latest versions are:
    WP Google Maps V6.0.4
    WP Google Maps Pro V6.19

    Can you please confirm if you are using WP Google Maps – https://wordpress.org/plugins/wp-google-maps/ – so that I can assist you further?

    Thanks for your time in this.

    Kind regards,
    Dylan

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.