How to Change the Password Field Sublabels


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.

Sublabels on Password field by default appear below the form field

In this tutorial, we’ll show you how to use PHP to change the text of these sublabels.

Creating the form

First, we’ll begin by creating our form and adding our form fields. We’ll also add the Password form field and enable the Enable Password Confirmataion.

add the Password field and click to Enable Password Confirmation

Adding the snippet

In order to change the text that appears below the Password form field, we’ll need to add this snippet to our site.

If you need any help in how to add snippets to your site, please see this tutorial.

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

function wpf_dev_password_field_properties( $properties, $field, $form_data ) {
    // Change sublabel values on the primary password field
    $properties[ 'inputs' ][ 'primary' ][ 'sublabel' ][ 'value' ] = __( 'Please enter a password that you will use to sign on to your account.', 'your-text-domain' );
	// Chhange the sublabel values on the secondary password field
    $properties[ 'inputs' ][ 'secondary' ][ 'sublabel' ][ 'value' ] = __( 'Please re-enter that password again just for confirmation.', 'your-text-domain' );
    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 all you need to change the sublabels. Would you like to automatically log in 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