Home Forums Bug Reports Google Maps ACF infinite JS loop


Google Maps ACF infinite JS loop

  • Hi,

    We found a bug with latests versions of WP and ACF Pro.
    When a Google Maps custom field is used and its data is filled with third party plugins, such as WP All Import Pro in our case, the coordinates are stored in database as long values, where ACF natively uses string.
    Those long values are legitimate because Google Maps geocoding API provides long values.
    When rendering the field, ACF outputs the long value coordinates in the DOM with a comma instead of a dot. (in backend edition)
    Finally the JS gets unstable with this incorrect notation, generating an infinite loop locking the browser.

    We developed the bugfix for this :

    in this file : advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php

    after this block :

    		// value
    		$field['value'] = wp_parse_args($field['value'], array(
    			'address'	=> '',
    			'lat'		=> '',
    			'lng'		=> ''

    add this block :

    		// ensure dot notation for coordinates
     		$field['value']['lat'] = str_replace( ',', '.', $field['value']['lat'] );
     		$field['value']['lng'] = str_replace( ',', '.', $field['value']['lng'] );

    Is it possible to include this in the next relase ?


Viewing 1 post (of 1 total)

The topic ‘Google Maps ACF infinite JS loop’ is closed to new replies.