Skip to content
  • Log In
  • Register
WordPress.org
  • News
  • Download & Extend
    • Get WordPress
    • Themes
    • Patterns
    • Plugins
    • Openverse
    • Mobile
    • Hosting
  • Learn
    • Learn WordPress
    • Documentation
    • Forums
    • WordPress.tv
    • Developers
  • Community
    • Make WordPress
    • WordCamp
    • Meetups
    • Photo Directory
    • Job Board
    • Five for the Future
  • About
    • About WordPress
    • Showcase
    • Gutenberg
    • Enterprise
  • Get WordPress
Get WordPress

Developer Resources

Browse: Home / Reference / Hooks / register_form

do_action( 'register_form' )

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

Contents

  • More Information
  • Source
  • Changelog
  • User Contributed Notes

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.

Top ↑

Source

File: wp-login.php. View all references

do_action( 'register_form' );

View on Trac View on GitHub


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 1You must log in to vote on the helpfulness of this note
    Contributed by Tom Carney — 3 years ago

    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
    }
    Log in to add feedback
  2. Skip to note 2 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Tom Carney — 3 years ago

    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.

    Log in to add feedback

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

  • About
  • News
  • Hosting
  • Donate
  • Swag
  • Documentation
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
  • Visit our Instagram account
  • Visit our LinkedIn account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.