• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Add Lost Password Link

This code enables you to add a link to create a new password via email.

lost-password

Once you submit the form, you’ll be redirected back to the URL where you clicked the link. You will also recieve a email with link to reset your password.

The link works in exactly the same way as the link added below the login form.

You can also determine which URL the form redirects to after submission.

The following code snippets use wp lostpassword url

Themes Template File

If you’re using a theme like Twenty Sixteen, you can add trhe folloowing code to any template file like the header.php or footer.php.

<span class="lost-password">
<a href="<?php echo wp_lostpassword_url( get_permalink() ); ?>" title="Lost Password">Lost your password?</a>
</span><!-- .lost-password -->

Themes With Custom Hooks

Themes with custom hooks like Genesis, enable you to hook the link in from your functions file.

add_action( 'genesis_header_right', 'lost_password_link' );
function lost_password_link() {
printf( '<a class="button" href="%s" title="Lost Password">Lost Password</a>', wp_lostpassword_url( get_permalink() ) );
}

Related Code

  • Add Login Logout Link To Any Nav Menu

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems