WordPress.org

Codex

Plugin API/Action Reference/register form

Contents

Description

The 'register_form' action hook is used to customize the built-in WordPress registration form.

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.

Example

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','myplugin_add_registration_fields');

function 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','mydomain') ?><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
}

Source File

The registration_errors hook is located in wp-login.php

Related

Tutorials

Action Hooks

Filter Hooks


Return to Plugin API/Action Reference