Support

Account

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();
    
    						});
    
    					}
    				});
    
    			}
    
    		}
    
    	});