Home › Forums › Backend Issues (wp-admin) › TypeError: google.load is not a function › Reply To: TypeError: google.load is not a function
My work-around is a double check as the following code to substitute the function on line 2268:
$(document).on('acf/setup_fields', function(e, el) {
// vars
$fields = $(el).find('.acf-google-map');
// validate
if (!$fields.exists()) {
return;
}
// validate google
if (typeof google === 'undefined') {
$.getScript('https://www.google.com/jsapi', function() {
google.load('maps', '3', {
other_params: 'sensor=false&libraries=places',
callback: function() {
$fields.each(function() {
acf.fields.google_map.set({
$el: $(this)
}).init();
});
}
});
});
} else {
if (typeof google.load != 'function') {
$.getScript('https://www.google.com/jsapi', function() {
google.load('maps', '3', {
other_params: 'sensor=false&libraries=places',
callback: function() {
$fields.each(function() {
acf.fields.google_map.set({
$el: $(this)
}).init();
});
}
});
});
} else {
google.load('maps', '3', {
other_params: 'sensor=false&libraries=places',
callback: function() {
$fields.each(function() {
acf.fields.google_map.set({
$el: $(this)
}).init();
});
}
});
}
}
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.