How to Change Sublabels for the Email Field

Overview

Would you like to change sublabels on your form Email fields? You can change the sublabels that appear below the email on your form. In this tutorial, we’ll show you the basics of how you can change the sublabels using a PHP code snippet.

In WPForms when you enable the Email Confirmation box on the Email form field, sublabels are automatically added below the Email fields.

Enable the Email Confirmation inside the Form Builders

When showing more than one subfield, sublabels will be displayed to show the user what they should enter for each.

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 Email and Confirm Email subfield labels. Just replace the text between each set of single quotes with the new text you’d like to display.

/**
 * Customize email field properties.
 *
 * @link https://wpforms.com/developers/how-to-change-sublabels-for-the-email-field/
 *
 */
function wpf_dev_email_field_properties( $properties, $field, $form_data ) {
     
    // Change sublabel values
    $properties['inputs']['primary']['sublabel']['value'] = 'Enter Your Email';
    $properties['inputs']['secondary']['sublabel']['value'] = 'Confirm Your Email';
 
    return $properties;
}
add_filter( 'wpforms_field_properties_email' , 'wpf_dev_email_field_properties', 10, 3 );

2) Multi-Lingual


/**
 * Customize email field properties.
 *
 * @link https://wpforms.com/developers/how-to-change-sublabels-for-the-email-field/
 *
 */
function wpf_dev_email_field_properties( $properties, $field, $form_data ) {
     
    // Change sublabel values
    $properties['inputs']['primary']['sublabel']['value'] = __( 'Enter Your Email', 'plugin-domain' );
    $properties['inputs']['secondary']['sublabel']['value'] = __( 'Confirm Your Email', 'plugin-domain' );
 
    return $properties;
}
add_filter( 'wpforms_field_properties_email' , 'wpf_dev_email_field_properties', 10, 3 );

Using PHP you can change sublabels on the email field

And that’s it! You’ve successfully changed the sublabels on the Email field! Would you like to change the sublabels for the Name field as well? Take a look at our article on How to Change Sublabels for the Name Field.

Filter Reference: wpforms_field_properties