• Resolved titk

    (@titk)


    Hello,

    I am setting up a website for a customer, and this plugin seems to provide what I need.

    I followed up documentation to set up google API Keys for the plugin. However, when I insert the plugin to a page, the map first show, and then are quickly replaced with the following message:

    Oops! Something went wrong. This page didn’t load Google Maps correctly. See the JavaScript console for technical details.

    This happens also in the settings tab.

    When I look at the console, this is showing:

    Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error

    Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

    This looks like there is no API key, but they are there. I checked on google maps API and all required services are active. Also, I checked that the code for the plugin was correctly inserted in the page.

    I tried to deactivate all the other plugins on the site, without success.

    I might have missed something, but can’t figure out what it is.

    I would be very grateful if you have some suggestion on what the problem could be.

    Regards,

    Lionel

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter titk

    (@titk)

    Some precisions, after searching a little more.

    The include for google maps script on the page looks like this:

    <script type=’text/javascript’ src=’https://maps.google.com/maps/api/js’></script&gt;

    API key should be there but doesn’t get included for some reason.

    I checked the database, both keys are there, in wp_options table, wpsl_settings option.

    Thread Starter titk

    (@titk)

    I found the problem after several hours of search, so I share it, maybe it could help someone.

    I found this on my theme functions.php:

    function billio_remove_script_version( $src ){

    $parts = @explode( ‘?’, $src );
    if (substr_count($parts[0],’googleapis.com’)>0 {
    return $src;
    } else {
    return $parts[0];
    }
    }

    This means they were removing all parameters from scripts…

    I changed it to the following:

    function billio_remove_script_version( $src ){

    $parts = @explode( ‘?’, $src );
    if (substr_count($parts[0],’googleapis.com’)>0 || substr_count($parts[0],’maps.google.com’)>0) {
    return $src;
    } else {
    return $parts[0];
    }
    }

    Everything seems to work now.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Google Maps API error’ is closed to new replies.