Using Gravity Forms ‘gform_disable_address_map_link’ PHP filter

The gform_disable_address_map_link filter in Gravity Forms is used to disable the “Map It” link when displaying the Address field value.

Usage

add_filter('gform_disable_address_map_link', '__return_true');
// your custom code here

Parameters

This filter has no parameters.

More information

See Gravity Forms Docs: gform_disable_address_map_link

Place this code in the functions.php file of your active theme.

The filter is located in GF_Field_Address::get_value_entry_detail() in includes/fields/class-gf-field-address.php.

Examples

Disable the “Map It” link for address fields in all forms.

add_filter('gform_disable_address_map_link', '__return_true');

Disable the “Map It” link for address fields in form with ID 5.

function disable_map_link_for_form_5($disable, $form) {
    if ($form['id'] == 5) {
        return true;
    }
    return $disable;
}
add_filter('gform_disable_address_map_link', 'disable_map_link_for_form_5', 10, 2);

Disable the “Map It” link for address fields with a specific field ID (15) in all forms.

function disable_map_link_for_field_15($disable, $field) {
    if ($field->id == 15) {
        return true;
    }
    return $disable;
}
add_filter('gform_disable_address_map_link', 'disable_map_link_for_field_15', 10, 2);

Disable the “Map It” link for address fields with a specific field ID (20) in form with ID 8.

function disable_map_link_for_form_8_field_20($disable, $field, $form) {
    if ($form['id'] == 8 && $field->id == 20) {
        return true;
    }
    return $disable;
}
add_filter('gform_disable_address_map_link', 'disable_map_link_for_form_8_field_20', 10, 3);

Disable the “Map It” link for address fields for users with the “subscriber” role.

function disable_map_link_for_subscribers($disable) {
    if (current_user_can('subscriber')) {
        return true;
    }
    return $disable;
}
add_filter('gform_disable_address_map_link', 'disable_map_link_for_subscribers');