do_action( ‘register_form’ )

Fires following the ‘Email’ field in the user registration form.

More Information

  • Use in conjunction with ‘registration_errors‘ (for validation) and ‘register_post‘ (save extra data) when customizing registration.
  • WordPress MS Note: For WordPress MS (Multi-Site), use the ‘signup_header‘ action to redirect users away from the signup.

Source

do_action( 'register_form' );

Changelog

VersionDescription
2.1.0Introduced.

User Contributed Notes

  1. Skip to note 3 content

    This example demonstrates how to add a new field to the registration form. Keep in mind that this won’t be saved automatically. You will still need to set up validation rules and manually handle saving of the additional form fields.

    add_action( 'register_form', 'wporg_myplugin_add_registration_fields' );
    
    function wporg_myplugin_add_registration_fields() {
    
        // Get and set any values already sent
        $user_extra = ( isset( $_POST['user_extra'] ) ) ? $_POST['user_extra'] : '';
        ?>
    
        <p>
            <label for="user_extra"><?php _e( 'Extra Field', 'myplugin_textdomain' ) ?><br />
            <input type="text" name="user_extra" id="user_extra" class="input" value="<?php echo esc_attr( stripslashes( $user_extra ) ); ?>" size="25" /></label>
        </p>
    
        <?php
    }
  2. Skip to note 4 content

    To modify or translate the registration form , page or fieldnames, you can use the following function:

    function my_translate() {
    
       $your_content = ob_get_contents();
       $your_content = preg_replace( '/\<label for="user_login"\>(.*?)\<br/', 'Usernumia: ', $content );
       $your_content = preg_replace( '/\<label for="user_email"\>(.*?)\<br/', 'Email Sior:', $content );
    
       ob_get_clean();
       echo $your_content;
    }
    add_action( 'register_form', 'my_translate' );

    Choose the codes/blocks for translation accurately, otherwise the above function may change other parts of the registration page.

You must log in before being able to contribute a note or feedback.