Add register/forgot password links to wp_login_form()

If you want to build a custom login page by using the builtin WP function wp_login_form(), you will notice that there is no register or forgot password link.

If you want to take them back, just hook these links as following:

add_action( 'login_form_bottom', 'add_register_lost_password_link' );
function add_register_lost_password_link() {
$add_links = '<a href="/wp-login.php?action=register">Register</a><a href="/wp-login.php?action=lostpassword">Lost your password?</a>'; 
  return $add_links;
}

There are 3 hooks available:

  • login_form_top
  • login_form_middle
  • login_form_bottom

Where Do I Put This Code?

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

One thought on “Add register/forgot password links to wp_login_form()

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>