我公司的位置页面上的Google地图功能正在显示并显示一条错误消息。我发现这不是来自API密钥。因此,我进入了Google Cloud Platform,并读取了一个API密钥以插入到位置页面代码中。该网站是由我之前的某个人建立的,这是我可以在建议API的代码中找到的唯一信息:
add_action('wp_enqueue_scripts', function(){
wp_register_script( 'googlemaps', 'https://maps.googleapis.com/maps/api/js?v=3.exp', array(), null, false );
wp_enqueue_script( 'googlemaps' );
wp_register_script( 'locationscript', get_stylesheet_directory_uri() . '/js/location.scripts.js', array( 'jquery' ));
wp_enqueue_script( 'locationscript' );
});
Google云平台指示我插入以下代码:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAjvClACTahW6B2ATZXq5ZM-rpSG4ThtLk&callback=initMap"
type="text/javascript"></script>
我曾尝试在我的位置页面上插入此代码,但地图仍然带有错误。我也尝试过切换
'https://maps.googleapis.com/maps/api/js?v=3.exp'
收件人:
'https://maps.googleapis.com/maps/api/jjs?key=AIzaSyAjvClACTahW6B2ATZXq5ZM-rpSG4ThtLk&callback=initMa'
但无济于事。有任何想法吗?