How to avoid redirect on the main log in form on wordpress? -
i add together login form on page , want add together js validation if login incomplete information. problem when log , seek null password or username wordpress redirect page on main login form. output want remain on current page can create js validation. help.
add in functions.php
add_action( 'wp_login_failed', 'my_front_end_login_fail' ); // hook failed login function my_front_end_login_fail( $username ) { $referrer = $_server['http_referer']; // did post submission come from? // if there's valid referrer, , it's not default log-in screen if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { wp_redirect( $referrer . '?login=failed' ); // let's append info (login=failed) url theme utilize exit; } }
referal url: http://www.wpinsite.com/code-snippets/how-to-redirect-wordpress-failed-logins
wordpress
No comments:
Post a Comment