show_user_form

The timeline below displays how wordpress function show_user_form has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Displays the fields for the new user account registration form.
 *
 * @since MU (3.0.0)
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // Username.
    echo '<label for="user_name">' . __('Username:') . '</label>';
    $errmsg_username = $errors->get_error_message('user_name');
    $errmsg_username_aria = '';
    if ($errmsg_username) {
        $errmsg_username_aria = 'wp-signup-username-error ';
        echo '<p class="error" id="wp-signup-username-error">' . $errmsg_username . '</p>';
    }
    ?>
	<input name="user_name" type="text" id="user_name" value="<?php 
    echo esc_attr($user_name);
    ?>" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" required="required" aria-describedby="<?php 
    echo $errmsg_username_aria;
    ?>wp-signup-username-description" />
	<p id="wp-signup-username-description"><?php 
    _e('(Must be at least 4 characters, lowercase letters and numbers only.)');
    ?></p>

	<?php 
    // Email address.
    echo '<label for="user_email">' . __('Email&nbsp;Address:') . '</label>';
    $errmsg_email = $errors->get_error_message('user_email');
    $errmsg_email_aria = '';
    if ($errmsg_email) {
        $errmsg_email_aria = 'wp-signup-email-error ';
        echo '<p class="error" id="wp-signup-email-error">' . $errmsg_email . '</p>';
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" autocomplete="email" required="required" aria-describedby="<?php 
    echo $errmsg_email_aria;
    ?>wp-signup-email-description" />
	<p id="wp-signup-email-description"><?php 
    _e('Your registration email is sent to this address. (Double-check your email address before continuing.)');
    ?></p>

	<?php 
    // Extra fields.
    $errmsg_generic = $errors->get_error_message('generic');
    if ($errmsg_generic) {
        echo '<p class="error" id="wp-signup-generic-error">' . $errmsg_generic . '</p>';
    }
    /**
     * Fires at the end of the new user account registration form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 5.6

/**
 * Displays the fields for the new user account registration form.
 *
 * @since MU (3.0.0)
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // Username.
    echo '<label for="user_name">' . __('Username:') . '</label>';
    $errmsg = $errors->get_error_message('user_name');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    $errmsg = $errors->get_error_message('user_email');
    if ($errmsg) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    $errmsg = $errors->get_error_message('generic');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the new user account registration form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 5.4

/**
 * Display user registration form
 *
 * @since MU (3.0.0)
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // Username.
    echo '<label for="user_name">' . __('Username:') . '</label>';
    $errmsg = $errors->get_error_message('user_name');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    $errmsg = $errors->get_error_message('user_email');
    if ($errmsg) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    $errmsg = $errors->get_error_message('generic');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 5.1

/**
 * Display user registration form
 *
 * @since MU (3.0.0)
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // User name
    echo '<label for="user_name">' . __('Username:') . '</label>';
    $errmsg = $errors->get_error_message('user_name');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    $errmsg = $errors->get_error_message('user_email');
    if ($errmsg) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    $errmsg = $errors->get_error_message('generic');
    if ($errmsg) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 4.9

/**
 * Display user registration form
 *
 * @since MU (3.0.0)
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // User name
    echo '<label for="user_name">' . __('Username:') . '</label>';
    if ($errmsg = $errors->get_error_message('user_name')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    if ($errmsg = $errors->get_error_message('user_email')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    if ($errmsg = $errors->get_error_message('generic')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 4.6

/**
 * Display user registration form
 *
 * @since MU
 *
 * @param string          $user_name  The entered username.
 * @param string          $user_email The entered email address.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // User name
    echo '<label for="user_name">' . __('Username:') . '</label>';
    if ($errmsg = $errors->get_error_message('user_name')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    if ($errmsg = $errors->get_error_message('user_email')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    if ($errmsg = $errors->get_error_message('generic')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param WP_Error $errors A WP_Error object containing containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 4.0

/**
 * Display user registration form
 *
 * @since MU
 *
 * @param string $user_name The entered username
 * @param string $user_email The entered email address
 * @param array $errors
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    // User name
    echo '<label for="user_name">' . __('Username:') . '</label>';
    if ($errmsg = $errors->get_error_message('user_name')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    if ($errmsg = $errors->get_error_message('user_email')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="email" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    if ($errmsg = $errors->get_error_message('generic')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param array $errors An array possibly containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}

WordPress Version: 3.7

/**
 * Display user registration form
 *
 * @since MU
 *
 * @param string $user_name The entered username
 * @param string $user_email The entered email address
 * @param array $errors
 */
function show_user_form($user_name = '', $user_email = '', $errors = '')
{
    // User name
    echo '<label for="user_name">' . __('Username:') . '</label>';
    if ($errmsg = $errors->get_error_message('user_name')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr($user_name) . '" maxlength="60" /><br />';
    _e('(Must be at least 4 characters, letters and numbers only.)');
    ?>

	<label for="user_email"><?php 
    _e('Email&nbsp;Address:');
    ?></label>
	<?php 
    if ($errmsg = $errors->get_error_message('user_email')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?></p>
	<?php 
    }
    ?>
	<input name="user_email" type="text" id="user_email" value="<?php 
    echo esc_attr($user_email);
    ?>" maxlength="200" /><br /><?php 
    _e('We send your registration email to this address. (Double-check your email address before continuing.)');
    ?>
	<?php 
    if ($errmsg = $errors->get_error_message('generic')) {
        echo '<p class="error">' . $errmsg . '</p>';
    }
    /**
     * Fires at the end of the user registration form on the site sign-up form.
     *
     * @since 3.0.0
     *
     * @param array $errors An array possibly containing 'user_name' or 'user_email' errors.
     */
    do_action('signup_extra_fields', $errors);
}