WordPress – How to automatically redirect users after password reset

The following code can be used to automatically redirect users after they’ve reset their password.

This code will automatically redirect them to the home page.

function itsg_after_password_reset_redirect() {
    wp_redirect( home_url() ); 
    exit; // always exit after wp_redirect
}
add_action('after_password_reset', 'itsg_after_password_reset_redirect');

Note:

I highly recommend any customisations are placed into a custom plugin (NOT your theme’s functions.php file) – this way you can easily enable/disable the customisations and keep them when you update or replace your theme.

See How to create a WordPress plugin for your custom functions for how to do this.

Was this article helpful?

Related Articles