gform_password

Description

Use this filter to change the Password Field sub-label.

Usage

The following would apply your function to all forms.

add_filter( 'gform_password', 'your_function_name', 10, 2 );

To target a specific form append the form id to the hook name. (format: gform_password_FORMID)

add_filter( 'gform_password_6', 'your_function_name', 10, 2 );

Parameters

ParameterTypeDescription
$sublabelstringThe sub-label to be filtered.
$form_idintegerID of current form.

Examples

Change the password sub-label.

This example changes the password sub-label to “Enter a password” on Form ID 185.

add_filter( 'gform_password_185', 'set_password_label', 10, 2 );
function set_password_label( $sublabel, $form_id ) {
	return 'Enter a password';
}

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 GF_Field_Password::get_field_input() in includes/fields/class-gf-field-password.php.