How to Change the Password Field Sublabels

Overview

Would you like to change the sublabels on the Password field in WPForms? The Password field has sublabels under the field when the Enable Password Confirmation option is enabled.

Default sublabels on Password field
These sublabels can be changed with a small PHP snippet and in this tutorial, we’ll show you how.

Implementation Options

If you wanted to modify the text that shows under the Email fields, you can easily do this by adding some PHP code to your site.

1) Single Language

The code below can be used to modify the default Password and Confirm Password subfield labels. Just replace the text between each set of single quotes with the new text you’d like to display.

/**
 * Change the sublabels for the Password field.
 *
 * @link https://wpforms.com/developers/how-to-change-the-password-field-sublabels/
 *
 */
function wpf_dev_password_field_properties( $properties, $field, $form_data ) {
      
    // Change sublabel values
    $properties['inputs']['primary']['sublabel']['value'] = 'Please enter a password that you will use to sign on to your account.';
    $properties['inputs']['secondary']['sublabel']['value'] = 'Please re-enter that password again just for confirmation.';
  
    return $properties;  
    return $properties;
}
add_filter( 'wpforms_field_properties_password' , 'wpf_dev_password_field_properties', 10, 3 );

2) Multi-Lingual

/**
 * Change the sublabels for the Password field.
 *
 * @link https://wpforms.com/developers/how-to-change-the-password-field-sublabels/
 *
 */
function wpf_dev_password_field_properties( $properties, $field, $form_data ) {
      
    // Change sublabel values
    $properties['inputs']['primary']['sublabel']['value'] = __( 'Please enter a password that you will use to sign on to your account.' );
    $properties['inputs']['secondary']['sublabel']['value'] = __( 'Please re-enter that password again just for confirmation.' );
  
    return $properties;  
    return $properties;
}
add_filter( 'wpforms_field_properties_password' , 'wpf_dev_password_field_properties', 10, 3 );

Password field sublabels after code snippet has been added to your site

And that’s it! Would you like to automatically log in the users after they’ve completed the registration process? Take a look at our tutorial on How to Automatically Log in Users After Registration.

Filter Reference: wpforms_field_properties