Created
November 12, 2012 19:44
-
-
Save jllodra/4061455 to your computer and use it in GitHub Desktop.
Wordpress "custom redirect when login fails" plug-in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*/ | |
Plugin Name: Fail login redirect | |
Plugin URI: http://herotyc.untergrund.net | |
Description: Redirect to custom page when login fails | |
Version: 1.0 | |
Author: Josep Llodra | |
Author URI: http://herotyc.untergrund.net | |
/*/ | |
add_filter('login_redirect', '_catch_login_error', 10, 3); | |
function _catch_login_error($redir1, $redir2, $wperr_user) | |
{ | |
if(!is_wp_error($wperr_user) || !$wperr_user->get_error_code()) return $redir1; | |
switch($wperr_user->get_error_code()) | |
{ | |
case 'incorrect_password': | |
case 'empty_password': | |
case 'invalid_username': | |
default: | |
wp_redirect('/wordpress/login-failed/'); // modify this as you wish | |
} | |
return $redir1; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment