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 / login_form

do_action( 'login_form' )

Fires following the ‘Password’ field in the login form.

Contents

  • More Information
  • Source
  • Changelog
  • User Contributed Notes

More Information

It can be used to customize the built-in WordPress login form. Use in conjunction with ‘login_head‘ (for validation).


Top ↑

Source

File: wp-login.php. View all references

do_action( 'login_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: 0You must log in to vote on the helpfulness of this note
    Contributed by Steven Lin — 2 years ago

    Example migrated from Codex:

    This example demonstrates how to add a new field to the login 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( 'login_form', 'myplugin_add_login_fields' );
    
    function myplugin_add_login_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
    }
    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 Steven Lin — 2 years ago

    Example migrated from Codex:

    The following example demonstrates how to translate the login form, page, fields or labels. Choose the codes/blocks for translation accurately, otherwise the above function may change other parts of the login page.

    function my_translatorr2() {
    
      $your_content = ob_get_contents();
      $your_content = preg_replace( '/\<label for="user_login"\>(.*?)\<br/', 'Usernumia: ', $your_content );
      $your_content = preg_replace( '/\<label for="user_pass"\>(.*?)\<br/', 'Passwiert:', $your_content );
    
      ob_get_clean();
      echo $your_content;
    }
    add_action( 'login_form', 'my_translatorr2' );
    Log in to add feedback
  3. Skip to note 3 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 Steven Lin — 2 years ago

    Example migrated from Codex:

    add_action( 'login_form', 'login_extra_note' );
    
    function login_extra_note() {
    
        //Adding the text
    
        ?>
        <p>You can type a little note to those logging in here.</p>
    
        <?php
    }
    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.