asked 5 years ago

I asked about this questions earlier. How to stop navigating to default wp login page when wrong username or password given and to give error message on the same page like ajax.
Im using easywp namecheap hosting so ftp logins will work only for 12 hrs when generated.
Code you send before was not working to stop directing

2 Answers
answered 5 years ago

I have checked on our demo site and the code works fine. In this case, you can try the following code:

add_action( 'wp_login_failed', 'custom_login_failed' );
function custom_login_failed( $username )
    $referrer = wp_get_referer();
   if ( $referrer && ! strstr($referrer, 'wp-login') && ! strstr($referrer,'wp-admin') )
        wp_redirect( add_query_arg('login', 'failed', $referrer) );

If you still face their issue, you can send me the username & password of your site for further checking. 

Jonas Frese
answered 5 years ago

Any more infos?

Dominic Staff
replied 5 years ago

If you have the same issue, you can use the code in the previous answer, you can send me your username & password of your site and FTP account for further checking if the code is not working.

Powered by DW Question & Answer Pro