google-jsapi, google-maps

Posted on May 11, 2021

URL to Google API services.

Description

The filter hook “google-jsapi” and “google-maps” assign the URL to Google API Client Libraries for Google Charts and Google Maps API.

Parameters

google-apis

  • $url
    (string) https://www.google.com/jsapi for Google Charts

google-maps

  • $url
    (string) //maps.googleapis.com/maps/api/js for Google Maps

Use case

The following code in your functions.php can override the default value.

function my_google_jsapi( $url ) {
    return 'https://www.google.cn/jsapi';
}
function my_google_maps( $url ) {
    return 'https://maps.google.cn/maps/api/js';
}
add_filter( 'google-jsapi', 'my_google_jsapi' );
add_filter( 'google-maps',  'my_google_maps'  );
NOTE: When you select "mu-plugins" (ip-location-block-mu.php) as Validation timing , you should put your code snippet into drop-in.php in Geolocation API folder instead of functions.php. See My custom functions in “functions.php” doesn’t work. in FAQ for detail.

Since

0.3.0.5