WordPress Logiin failed redirects to admin login page

13th Jul 2012 at 8:18 AM | Posted in Wordpress | Leave a comment

In front end login for if you use action to wp-login.php and when user give invalid login details it redirects to admin login page.

To get rid of this add the below code to your plugin page of theme’s functions.php

add_filter('authenticate', 'check_login', 10, 3);
function check_login($user, $username, $password) {
$user = get_userdatabylogin($username);
if($_POST['redirect_to'] =='your-redirect-to' & !$user)
wp_redirect($_POST['redirect_to']);
}
Advertisements

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: