Support » Fixing WordPress » How can I redirect to home after password reset

  • Hi!

    I’ve been looking for a solution for days now, and none of them have worked. This is the last one I found and used it in my function.php file in my childtheme:

    <?php
    function wpse_lost_password_redirect() {

    // Check if have submitted
    $confirm = ( isset($_GET[‘action’] ) && $_GET[‘action’] == resetpass );

    if( $confirm ) {
    wp_redirect( home_url() );
    exit;
    }
    }
    add_action(‘login_headerurl’, ‘wpse_lost_password_redirect’);
    ?>

    How can I achieve this please, my site is all frontend, I don’t want users to go in the backend, it’ll confuse them.

    I hope someone has the real solution.

    Thanks!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator t-p

    (@t-p)

    try this:

    function wpse_lost_password_redirect() {
    
        // Check if have submitted
        $confirm = ( isset($_GET['checkemail'] ) ? $_GET['checkemail'] : '' );
    
        if( $confirm ) {
            wp_redirect( home_url() );
            exit;
        }
    }
    add_action('login_headerurl', 'wpse_lost_password_redirect');
    Thread Starter carolaword

    (@carolaword)

    mm no…
    When it says your password has been reseted, and then login, that loging always has a …/login.php url always.
    I’ll just remove that and leave the Back to the site link that appears under it.
    Thanks anyway Tara

    Tara’s solution actually works. You have to put the code in the functions.php file in your theme.

    Hello,

    Searching a solution for the same problem. Tryed to put the code above in my plugin and in the functions.php file of my theme, and none of these attempts has worked. Still locked. Carolworld, did you finally get it work ?

    • This reply was modified 7 years, 6 months ago by pongla.
    Thread Starter carolaword

    (@carolaword)

    Hi pongla,
    Try this in your functions.php:

    <?php

    add_filter( ‘lostpassword_redirect’, ‘my_redirect_home’ );
    function my_redirect_home( $lostpassword_redirect ) {
    return home_url();
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I redirect to home after password reset’ is closed to new replies.