Support

Account

Home Forums ACF PRO ACF Google Maps callback error Reply To: ACF Google Maps callback error

  • I came across the same issue just now. Turns out that in wp-content\plugins\advanced-custom-fields-pro\includes\fields\class-acf-field-google-map.php the callback param is set to an empty string:

    
    			// vars
    			$api = array(
    				'key'       => acf_get_setting( 'google_api_key' ),
    				'client'    => acf_get_setting( 'google_api_client' ),
    				'libraries' => 'places',
    				'ver'       => 3,
    				'callback'  => '',
    				'language'  => acf_get_locale(),
    			);
    

    Just below this there’s a filter we can use to override these params:

    
    			// filter
    			$api = apply_filters( 'acf/fields/google_map/api', $api );
    

    I found a post on Stack Overflow that suggests setting the callback param to Function.prototype, see https://stackoverflow.com/a/75212692

    This fix works for me:

    
    add_filter('acf/fields/google_map/api', function ($api) {
        $api['callback'] = 'Function.prototype';
        return $api;
    });