When using Toolset Maps with the Google Maps API, you have to update your theme to be able to use it in the People’s Republic of China. On this page, we explain how to do this. Azure Maps API is not affected by this.

Toolset Maps loads Google Maps resources, which are used for rendering the maps and the related information on them. People’s Republic of China has some specific rules for loading Google APIs in that country. They are required to be loaded from the Chinese Google domain – google.cn.

If you are using Toolset Map plugin in China, there are two additional hooks you need to add to your theme’s functions.php file.

add_filter( 'toolset_filter_toolset_maps_api_js_url', 'prefix_serve_maps_js_from_china' );

function prefix_serve_maps_js_from_china( $url ) {
    $url = 'http://maps.google.cn/maps/api/js';
    return $url;
}

add_filter( 'toolset_filter_toolset_maps_api_geocode_url', 'prefix_serve_maps_geocode_from_china' );

function prefix_serve_maps_geocode_from_china( $url ) {
    $url = 'http://maps.google.cn/maps/api/geocode/json';
    return $url;
}

This code will ensure that the Chinese domain is used for loading Google Maps API.

Please note that you need to use Toolset Maps plugin version 1.1 or higher for this to work.