Filter the address field: gravityview/maps/marker/address

When the address field is not stored in a regular Address field type or if you would need to perform string manipulation to the address field value before the Maps Premium View tries to geocode the address, there is a filter hook for that - gravityview/maps/marker/address - as shown in the following code snippet:

/**
 * Filter the address field content before geocoding
 * @param string $address Address value
 * @param array $entry Gravity Forms entry object
 */
function my_gv_maps_address_value( $address, $entry ) {
// Note: Replace the MY_FORM_ID by the Form ID where you'll want to apply this code.
    if ( 'MY_FORM_ID' != $entry['form_id'] ) {
        return $address;
    }
    // do something to $address
    return $address;
}
add_filter( 'gravityview/maps/marker/address', 'my_gv_maps_address_value', 10, 2 );

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us