wp_login_failed not working if only one field is filled out (4 posts)

  1. jst
    Posted 3 years ago #


    I created a login form in the frontend with wp_login_form(). In my functions.php 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

  2. Jackson
    Posted 3 years ago #

    wp_authenticate which calls do_action('wp_login_failed'... is a pluggable function (http://codex.wordpress.org/Pluggable_Functions), so you could copy it from pluggable.php to your theme's functions file and modify to suit your needs.

  3. jst
    Posted 3 years ago #

    Hi Jackson

    Thanks a lot for your reply! Got this to work now and learned something new!

    Thanks again

  4. webladynz
    Posted 3 years ago #

    I have the same problem, but being new to WP I do not understand how you solved this issue. Your assitance would be most appreciated

Topic Closed

This topic has been closed to new replies.

About this Topic