Home / Admin / Change Sublabels for the Name Field
Duplicate Snippet

Embed Snippet on Your Site

Change Sublabels for the Name Field

Using this snippet will allow you to customize the sublabels that appear under the Name field when using the First Last or the First Middle Last format.

100+
Code Preview
php
<?php
/**
 * Customize name field properties.
 *
 * @link   https://wpforms.com/developers/how-to-change-sublabels-for-the-name-field/
 * 
 * For support, please visit: https://www.facebook.com/groups/wpformsvip
 */
 
function wpf_dev_name_field_properties( $properties, $field, $form_data ) {
     
    // Change the text for the sublabel
    $properties[ 'inputs' ][ 'first' ][ 'sublabel' ][ 'value' ]  = __( 'First Name', 'plugin-domain' );
    $properties[ 'inputs' ][ 'middle' ][ 'sublabel' ][ 'value' ] = __( 'Middle Initial', 'plugin-domain' );
    $properties[ 'inputs' ][ 'last' ][ 'sublabel' ][ 'value' ]   = __( 'Last Name', 'plugin-domain' );
 
    return $properties;
}
 
add_filter( 'wpforms_field_properties_name' , 'wpf_dev_name_field_properties', 10, 3 );

Comments

Add a Comment