I would like to able to redirect to get_bloginfo('url');
after reseting password.
But I cannot for life of me find any simple answer or function to do this.
Does anyone know if this is possible?
Thank
Josh
I would like to able to redirect to get_bloginfo('url');
after reseting password.
But I cannot for life of me find any simple answer or function to do this.
Does anyone know if this is possible?
Thank
Josh
You must be logged in to post a comment.
Here is a simple solution. Im hooking into
login_headerurl
. Maybe there is a better hook for this but it works, Put this in your functions.php:What it does, it runs on
login_headerurl
and checks for the GET parameter “checkedmail” which you get after you submitted a valid username or email. Then i redirect by using the awsome function wp_redirect to the home_url.UPDATE after comment
If you want to redirect the user after submitted a new password you only need to use the hook password_reset here is an example:
The “correct” answer doesn’t work here because the action ‘password_reset’ fires before the password is reset.
I modified the first answer, before the update, to work.
Edit: Didn’t have enough rep to comment so I’m posting this as a new answer.
I can’t see how the “UPDATE after comment” answer works.
The documentation for the ‘password_reset’ hook says “Fires before the user’s password is reset.”.
If you redirect, then exit the password won’t get changed.
Since I had a similar need I developed my solution to the problem.
We still respond to the “password_reset” hook but instead of performing the redirect immediately we add a hook for the “login_url” filter.
And it’s in this filter that we add the redirections to the home page after the user has logged in.
Perhaps I’m missing something in the question, but is anything wrong with using the
lostpassword_redirect
filter?More here: https://codex.wordpress.org/Plugin_API/Filter_Reference/lostpassword_redirect
Rediret to is a wordpress feature you don’t need to create a plugin for it, just add &redirect_to= the url and it will work.
Example: