gform_address_state

Description

This filter is executed when creating the address state field and can be used to modify the “State” label.

Usage

Applies to all forms.

add_filter( 'gform_address_state', 'change_address_state', 10, 2 );

Applies to a specific form. In this case, form id 5.

add_filter( 'gform_address_state_5', 'change_address_state', 10, 2 );

Parameters

  • $label string

    The label to be filtered.

  • $form_id integer

    The current form’s id.

Examples

This example changes the default address state label:

add_filter( 'gform_address_state', 'change_address_state', 10, 2 );
function change_address_state( $label, $form_id ) {
    return "Address State";
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in js.php and GF_Field_Address::get_field_input() in includes/fields/class-gf-field-address.php.