• About WordPress
    • About WordPress
    • WordPress.org
    • Documentation
    • Support
    • Feedback
  • Log In
  • Register

WordPress.org

  • Showcase
  • Learn
  • Themes
  • Plugins
  • Mobile
  • Support
    • Documentation
    • Forums
  • Get Involved
    • Five for the Future
  • About
  • Blog
  • Hosting
  • Get WordPress

Code Reference

Skip to content
Filter by type:
Search
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 #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 #Source

File: wp-login.php

View on Trac


Top ↑

Changelog #Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes #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: 0You must log in to vote on the helpfulness of this note
    Contributed by Tom Carney — 1 year 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
    }
    

    Expand full source codeCollapse full source code

    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 — 1 year 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
  • Blog
  • Hosting
  • Donate
  • Support
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
  • @WordPress
  • WordPress

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.