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.
Comments
12 responses to “Change WordPress Login Message – Filter It Out”
Just what I needed!
Thanks for sharing mate 馃檪
Very useful. Looked for it for a while. Thank you very much!
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.
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,
Houston
This code seems to no longer work. Any ideas what has changed in the newer WordPress Versions?
Many thanks,
Houston
Still working perfectly – thanks!
still works – 5 years later
Thanks!!!
good to hear! thanks for posting.
After hours of searching … Perfect! Thank you so much 馃檪
Is there also such a script for the “Confirmation page” which is saying now: “Check your email for the confirmation link”
Forget my question above… I found out WordPress has a formal Dutch translation. Problem solved 馃檪