0

I want to write a plugin hook for wp-login.php?action=lostpassword.

Does anyone know what the add_action() is for wp-login.php?action=lostpassword?

I searched the CODEX and could not discover it.

Thank you.

1 Answer 1

2

The login form actions are located in wp-login.php here and here.

// "login_form_{$action}"
login_form_lostpassword
login_form_postpass
login_form_logout

lostpassword_form
resetpass_form
register_form

There's also the general login_init which will fire for all actions.

To enqueue scripts on login, use login_enqueue_scripts. Right after that, login_head will allow you to add custom meta tags, etc. to the <head>.

The end of the page is injectable with login_footer.

  • If you need to adjust (or add) errors, use lostpassword_post, which comes with an argument \WP_Error $errors.
  • If it's about passwords, you can use validate_password_reset which has two arguments, first again the \WP_Error $errors and the current \WP_User $user as second (or another \WP_Error in case the user is errornous).
2
  • 1
    @tammy - there are a few more I've added above.
    – Milo
    Commented Oct 11, 2015 at 21:07
  • Thank you very much @Milo. login_init is exactly what I was looking for.
    – tammy
    Commented Oct 11, 2015 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.