I created a login form in the frontend with wp_login_form()
.
In my functions.php file I added an action to prevent the redirect to /wp-login.php if the login failed with
add_action(‘wp_login_failed’, â¦.
As it turns out the action only hooks if the username and password fields are filled in. If one of them is left empty I still get redirected to wp-login.php.
Is there a possibility to check if both fields are filled in to prevent the redirect?
Thanks
Julian
Add this filter to change how blank username/password is treated:
And then your original redirect on wp_login_failed will work with blank username/password as well.
The problem lies with the function
wp_authenticate()
(found in the filepluggable.php
)You have 2 options.
wp_authenticate()
(this is merely deleting a few characters in an if statement).