How to add a description to the user name input field in the registration form?

OK, that’s possible using JavaScript (jQuery lib). Code –

// load jquery on login screen if not loaded already
add_action( 'login_enqueue_scripts', 'wpse_login_head' );
function wpse_login_head(){
    wp_enqueue_script('jquery');
}

add_action( 'register_form', 'wpse_register_form' );
function wpse_register_form(){ ?>

    <!-- we have used an unique id for the description tag -->
    <span id="user_login_description" style=" display:none;" class="description"><?php _e("Description text"); ?></span>

    <!-- the following line of code move the description after the username input -->
    <script type="text/javascript">jQuery('#user_login_description').appendTo('#registerform p:nth-child(1) label').show();</script>
   <?php
}

Leave a Comment