我在我的 WordPress 網站上將 ACF 用于谷歌地圖。有時它作業正常,但大多數情況下地圖在頁面加載后沒有呈現并且控制臺拋出以下錯誤:
Uncaught ReferenceError: google is not defined
at initMap ((index):616)
at HTMLDivElement.<anonymous> ((index):1178)
at Function.each (jquery.min.js?ver=3.6.0:2)
at s.fn.init.each (jquery.min.js?ver=3.6.0:2)
at HTMLDocument.<anonymous> ((index):1176)
at e (jquery.min.js?ver=3.6.0:2)
at t (jquery.min.js?ver=3.6.0:2)

uj5u.com熱心網友回復:
看起來您需要添加地圖鍵。
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>
如果它存在,請確保它在標題中。
uj5u.com熱心網友回復:
如果有人遇到同樣的問題,當我更改document.ready為window.load. 在官方 ACF 檔案中,其document.ready
”
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/313505.html
標籤:WordPress的 谷歌地图 google-maps-api-3 高级自定义字段
