Support » Plugin: Sidebar Login Widget » Login fail redirect

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes I am getting an error with login fail also. The URL is:

    But it goes back to the homepage.

    Plugin Author Rashed Latif


    This plugin is developed in that way. When login attempt is failed it will redirect to home page. Because sidebar login widget will be on the home page sidebar in most of the cases so user can try to login again.

    But if you want that after the login failure it will be redirected to worpress login screen then replace the following code

    wp_redirect(home_url() . '/?login=failed&errcode='.$current_error );


    wp_redirect( $referrer . '/wp-login.php' );

    This line is in function called “handle_login_failure”

    Hope that will help.

    Thanks for the quick reply!

    In my case at least, there is no sidebar on the homepage. The code you’ve suggested (thanks!) adds the /wp-login.php to whatever the current URL is, so this doesn’t work if the login sidebar is on another page.

    I would suggest the following instead:

    wp_redirect( home_url() . '/wp-login.php' );


    Plugin Author Rashed Latif


    Yes thats definitely a solution but i just figured out both our solution may end up with redirection loop problem for some hosts.

    The best way to redirect to wp-login page is disable/remove the following portion of code and let wordpress handle it.

    add_action('wp_login_failed', 'handle_login_failure');
     * This method will handle the login failure process.
    function handle_login_failure($username){
    	// check what page the login attempt is coming from
      	global $current_error;
    	$referrer = $_SERVER['HTTP_REFERER'];
    	if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
    		wp_redirect(home_url() . '/?login=failed&errcode='.$current_error );


    I would like to be able to add link that goes directly to WP Login page.
    Actually when it redirect to the homepage where there is the Widget.

    The problem is that widget is in the bottom of the page, so not easy to find the right way for users to log in or register.

    Is there’s a way to make the link go straight to the WP login page or to force it to go there ?


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Login fail redirect’ is closed to new replies.