2

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');
Omar T
  • 103
  • 9
  • this might help you out - you can check if the url contains somthething - like action? : http://php.net/manual/en/function.strpos.php – Stender Sep 04 '17 at 14:01

0 Answers0