Why does my WordPress lost password redirect to 404 aswell

892 views Asked by At

I been working on a Wordpress PHP code which redirect the wp-admin to another URL string for example. it would change wp-admin to wp-login.php?mysecretstring=login. This works fine however which it comes to another URL like wordpress reset password & incorrect passwords it redirects to a 404 (wp-login.php?action=lostpassword). Is it possible to exclude the lost password url or change it?

function protection_login_page() {
        global $redux_demo;
        $QS = $redux_demo['zx-wpadmin-protect-key'];
        $httpconnection = $redux_demo['zx-wpadmin-protect-http'];
       /* $QS = '?mysecretstring=foobar';*/
        $theRequest = $httpconnection . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php' . '?'. $_SERVER['QUERY_STRING'];
        $theRequestlost = $httpconnection . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php?action=lostpassword' . '?'. $_SERVER['QUERY_STRING'];


        if ( site_url('/wp-login.php').$QS == $theRequest )  {
            echo '<div style="    color: #fff;
        background: rgba(0, 0, 0, 0.42);
        text-align: center;
        font-weight: 600;
        text-transform: uppercase;">Redirect Working</div>';
        } elseif ( site_url('/wp-login.php?action=lostpassword').$QS == $theRequestlost ) {

        }else {
            header('Location:/404.php');
        }
    }
    add_action('login_head', 'protection_login_page');
0

There are 0 answers