1. rob

    thanks pippin!

  2. Henry

    Very nice. Have seen something similar elsewhere but your code works.

    Is there a way to direct to a specific page and not the homepage?

    • Pippin

      Yes, just replace home_url() with the URL of the page you’d like to redirect to, or use the get_permalink() function.

  3. k3davis

    Is there a similar technique that can be used to redirect users on a front-end enabled password reset form, to prevent erroneous entries from redirecting to the back-end reset screen?

    • Pippin

      I’m not sure I understand what you mean.

    • k3davis

      I mean the form you fill out when you forget your password. It’s easy to use a similar method to make a front-end version of this, so that they enter the username/password they don’t have to be taken to a WP style screen to do so. However if they enter a username or password that’s not in WP, they get taken to the forgot password WP screen with an error message, roughly equivalent to the problem you described in this post.

    • Pippin

      Gotcha. Yes you could definitely do that, but the feature is not included in the plugin.

  4. federico

    Hello ! its a very good tip! so.. where have i to past this code ? in functions.php ????

    • Pippin

      Yep that works just fine.

  5. Patric

    This code works perfectly, thanks man!

  6. maxoud

    This will redirect the careless user only when both of login and password fields are set. If at least one of them is empty (blank), this will redirect him to /wp-login.php again. Not a solution to hide WordPress usage.

  7. Dan

    idem maxoud. any thought on that one?

  8. Dan

    I think I found a solution. take a look :

    function wp_authenticate($username, $password) {
    $username = sanitize_user($username);
    $password = trim($password);

    $user = apply_filters(‘authenticate’, null, $username, $password);

    if ( $user == null ) {
    $user = new WP_Error(‘authentication_failed’, __(‘ERROR: Invalid username or incorrect password.’));
    }

    $ignore_codes = array(’empty_username’, ’empty_password’);

    if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {

    // Put your code here

    }

    return $user;
    }

    Hope it works !

  9. rushi

    How can i show error message after text box of password when user enters wrong password ?

    • Pippin

      If you’re using my [login_form] short code, it will display an error already.

  10. Jornes

    Hey Pippin!
    Your code works perfectly. And this is what i was looking around from the net. I got you finally. Thanks for the tricks! 🙂

  11. Erik

    Hi!
    We´re planning to make our site multi-lingual.

    So how can we redirect English-speaking, Swedish-speaking and Spanish-speaking clients to different “LOGIN FAILED”-pages?

    Grateful for any ideas / solutions you might have
    /Erik

    • Pippin

      At this time we don’t have a built in way to handle that so it will require custom development. I’d recommend hiring a developer to do it (unless you have one on staff already): https://restrictcontentpro.com/consultants

  12. sadegh

    thats work but when use permalink for post this isnt work like that
    localhost/login-client-portal/&login=failed

  13. Dinakaramn

    Is there any way that we can redirect a member who is not verified their email address.?

  14. This will redirect the careless user only when both of login and password fields are set. If at least one of them is empty (blank), this will redirect him to /wp-login.php again. Not a solution to hide WordPress usage.

    • Pete

      Exactly!

  15. ali ft

    thanks to sharing , i used it ^_^

  16. Matt

    Tomorrow will be 9 years since you posted this, but I needed it today. Less than 5 minutes from the Google Search to successful implementation on my site. Thank you!

  17. Torrent Project

    I am in fact happy to glance at this weblog posts which includes plenty of
    valuable data, thanks for providing these information.

  18. MeTi Az

    Thank you for your best website, God willing 🙂

Comments are closed.