• Resolved teresasumisu

    (@teresasumisu)


    Hi!
    On my website I have a frontend-login (selfmade). But after the users log in via that, they can’t access the backend via the WPS Hide Login Login URL (or any other url) – they get redirected to 404, which is set at Options > “Redirection url”.
    I made the login just as wordpress recommends it, you can see my code below. (Except an ajax function is doing the login, which shouldn’t make a difference!)

    I found out, which codepart of wps hide login acts odd:

    if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && $pagenow !== 'admin-post.php' && $request['path'] !== '/wp-admin/options.php' ) {
       wp_safe_redirect( $this->new_redirect_url() );
       die();
    }

    This is the codepart which redirects me to 404, even though the user is logged in (I also printed out is_user_logged_in() and it returns true.)

    This is my code:

    
    add_action( 'wp_ajax_nopriv_logInUser', 'ii_ajax_log_in_user' );
    add_action( 'wp_ajax_logInUser', 'ii_ajax_log_in_user' );
    
    function ii_ajax_log_in_user(){ 
            $username = sanitize_text_field($_POST['email']);
            $password = $_POST['password'];
            $remember = $_POST['remember'];
            
            $login_data = array();
            $login_data['user_login'] = $username;
            $login_data['user_password'] = $password;
            if($remember) {$login_data['remember'] = true;}
            
            $user_verify = wp_signon( $login_data, false ); 

    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Redirected to “Redirection url” (404) after frontend-login’ is closed to new replies.