I'm trying to find a way to prevent the login screen from showing up when user makes a mistake filling out the login form.
So, right now, I have the login form printed on a custom template. But if the users makes a mistake filling it out, it redirects them to the wordpress form to try again. I want to redirect away from that.
This is the code I had but it's not working.
add_action('login_form', 'redirect_invalid_login');
function redirect_invalid_login(){
global $error;
if($error)
header('Location: '.get_bloginfo('url').'/client-login/?message=6');
}
Now login_form is too late I believe because stuff already gets printed to the page. I haven't been able to find a hook that works. Is there a hook for this? Or perhaps a different way to do it?