Skip to content

Change WordPress Login Message – Filter It Out

This is an add-on to my last post about customizing the login page. My client wanted to (very slightly) change the text a user sees on the Forgot Password page.

It took me way too long to come across the login_message filter.

here’s my function:

function forgotpass_message() {
 $action = $_REQUEST['action'];
 if( $action == 'lostpassword' ) {
 $message = '<p class="message">Please enter your email address. Then check your email inbox for instructions to reset your password.</p>';
 return $message;
add_filter('login_message', 'forgotpass_message');

The url on the forgot password page includes the query string “action=lostpassword” so that’s what I’m checking for with my $_REQUEST call. If we’re on the forgot password page, then make a new message and return it.

Some other possible values of the action query string (taken from wp-login.php):

  • logout
  • retrievepassword
  • resetpass
  • rp
  • register
  • login

I think “rp” is another form of reset password.

Happy WordPress login page customizing! Hopefully someone who is looking for this comes across it quicker than I did.

10 Comments (Add Yours)

  1. Just what I needed!

    Thanks for sharing mate 🙂

  2. Very useful. Looked for it for a while. Thank you very much!

  3. Many many thanks bro.

    I have one more query and i think you can help me to solve that.
    In wordpress i want to change lost your password to forgot password. Then what is the best practice?

    I did it via add_filter(gettext).

    • Hey Seeker, I’m really sorry, somehow this comment slipped through the cracks. I think that’s about the only way to do it. I took a quick look at wp-login.php and there doesn’t seem to be any filters around there to use.

  4. Just what I was looking for, thanks for sharing this!

    • Kassandra, it seems that this code worked for you. Would you mind sharing with me how you went about doing this? I have cut and pasted the code on this page into my functions.php page and I get nothing.

      Many thanks,

  5. This code seems to no longer work. Any ideas what has changed in the newer WordPress Versions?

    Many thanks,

  6. Still working perfectly – thanks!

  7. still works – 5 years later


Add Your Comment (Get a Gravatar)

Get a Gravatar! Your Name

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