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.

12 Comments (Add Yours)

  1. WordPress › Error

    The site is experiencing technical difficulties.