{"id":391997,"date":"2016-04-25T08:21:27","date_gmt":"2016-04-25T08:21:27","guid":{"rendered":"https:\/\/toolset.com\/?post_type=course-lesson&#038;p=391997"},"modified":"2020-11-16T10:12:59","modified_gmt":"2020-11-16T10:12:59","slug":"how-to-use-toolset-maps-plugin-in-china","status":"publish","type":"course-lesson","link":"https:\/\/toolset.com\/es\/course-lesson\/how-to-use-toolset-maps-plugin-in-china\/","title":{"rendered":"How to Use Google Maps API from China"},"content":{"rendered":"\n<p>Toolset Maps loads Google Maps resources, which are used for rendering the maps and the related information on them. People\u2019s 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 \u2013&nbsp;<strong>google.cn<\/strong>. If you are using Toolset Map plugin in China, there are two additional hooks you need to add to your theme\u2019s&nbsp;<strong>functions.php&nbsp;<\/strong>file.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( 'toolset_filter_toolset_maps_api_js_url', 'prefix_serve_maps_js_from_china' );\n \nfunction prefix_serve_maps_js_from_china( $url ) {\n$url = 'http:\/\/maps.google.cn\/maps\/api\/js';\nreturn $url;\n}\n \nadd_filter( 'toolset_filter_toolset_maps_api_geocode_url', 'prefix_serve_maps_geocode_from_china' );\n \nfunction prefix_serve_maps_geocode_from_china( $url ) {\n$url = 'http:\/\/maps.google.cn\/maps\/api\/geocode\/json';\nreturn $url;\n}\n<\/pre><\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>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. <\/p>\n\n\n\n<p>If you are using Azure Maps API there is no need for any changes to your theme\u2019s&nbsp;<strong>functions.php&nbsp;<\/strong>file.<\/p>\n","protected":false},"author":4341,"featured_media":1665215,"template":"","related-lesson":[8423],"class_list":["post-391997","course-lesson","type-course-lesson","status-publish","has-post-thumbnail","hentry","related-lesson-maps"],"_links":{"self":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/391997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson"}],"about":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/types\/course-lesson"}],"author":[{"embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/users\/4341"}],"version-history":[{"count":8,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/391997\/revisions"}],"predecessor-version":[{"id":1767871,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/391997\/revisions\/1767871"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/media\/1665215"}],"wp:attachment":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/media?parent=391997"}],"wp:term":[{"taxonomy":"related-lesson","embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/related-lesson?post=391997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}