Closed TechRemarker closed 6 years ago
The new format of the address is an array rather than string. This was changed because in some of the premium extensions it is possible to set the address field of the search form between a single address field ( which is the default with GEO my WP ) to multiple address field ( street, city, zipcode... ).
I am not sure if it can be easily change back to a string without breaking things. However, you can still easily retrieve the address value using $_GET['address'][0] instead of $_GET['address'].
Thanks for that info. While the change makes it a bit tougher since plugins like Gravity Forms aren't compatible with that array version, they did have a workaround of adding the following function incase anyone comes across the same question later on:
add_filter( 'gform_field_value_address', 'populate_address' ); function populate_address( $value ) { return $_GET['address'][0]; }
Thank you for sharing the solution.
I will look into this again and see if it will be easily possible to use the address value as a string when using the single address field. And use it as an array only when using multiple address fields.
However, I believe that keeping it consistence, as an array, will make it easier by preventing GEO my WP and other plugins from checking if the value is an array or not.
I am curious to know, if you don't mind me asking, how exactly do you use GEO my WP and Gravity Forms together?
In version 2.0, on the no results template the url would include for example: address=03000 (assuming you entered zip code 03000). This was incredibly helpful, since then you could easily grab that url parameter such as with Gravity Forms so you know what zip code the user was searching for that resulted in no results.
In 3.0 now it says, "address%5B0%5D=03000" in the url where "%5B0%5D" is presumably [0]. Is there a way we can return this to simply be address=03000 format so that url parameter is easily useable again?