Home / Admin / Changing sublabels for Email Field on a Single Form
Duplicate Snippet

Embed Snippet on Your Site

Changing sublabels for Email Field on a Single Form

This snippet is used to change sublabel for Email field on a specific form. Be sure to update the Form ID in the snippet with the ID of the form you'd like to change.

<10
Code Preview
php
<?php
/**
 * 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 ) {
	// Only process this snippet on the form ID 123
    if ( absint( $form_data[ 'id' ] ) !== 123 ) {
        return $properties;
    } 
    // Change sublabel values
    $properties[ 'inputs' ][ 'primary' ][ 'sublabel' ][ 'value' ]   = __( 'Enter Your Email', 'plugin-domain' );
    $properties[ 'inputs' ][ 'secondary' ][ 'sublabel' ][ 'value' ] = __( 'To confirm, re-enter your email address here', 'plugin-domain' );
    return $properties;
}
add_filter( 'wpforms_field_properties_email' , 'wpf_dev_email_field_properties', 10, 3 );

Comments

Add a Comment