Description
The gform_address_country filter allows developers to modify the “Country” label.
Usage
Applies to all forms.
add_filter( 'gform_address_country', 'change_address_country', 10, 2 );
Applies to a specific form. In this case, form id 5.
add_filter( 'gform_address_country_5', 'change_address_country', 10, 2 );
Parameters
Examples
Change the default address country label.
add_filter( 'gform_address_country', 'change_address_country', 10, 2 );
function change_address_country( $label, $form_id ) {
return "Address Country";
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in js.php and GF_Field_Address::get_field_input() in includes/fields/class-gf-field-address.php.