Description
This filter is executed when creating the last name field and can be used to modify the “Last” label.
Usage
add_filter( 'gform_name_last', 'change_last', 10, 2 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$label | string | The label to be filtered. |
$form_id | integer | The id of the current form. |
Examples
Change the last name label.
add_filter( 'gform_name_last', 'change_last', 10, 2 );
function change_last( $label, $form_id ) {
return 'Last Name';
}
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_Name::get_field_input() in includes/fields/class-gf-field-name.php.