Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Main redirection of the default login page */
- function qs_redirect_login_page() {
- $login_page = home_url('login');
- $page_viewed = basename($_SERVER['REQUEST_URI']);
- if($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
- wp_redirect($login_page);
- exit;
- }
- }
- add_action('init','qs_redirect_login_page');
- /* Where to go if a login failed */
- function qs_custom_login_failed() {
- $login_page = home_url('login');
- wp_redirect($login_page . '?login=failed');
- exit;
- }
- add_action('wp_login_failed', 'qs_custom_login_failed');
- /* Where to go if any of the fields were empty */
- function qs_verify_user_pass($user, $username, $password) {
- $login_page = home_url('login');
- if($username == "" || $password == "") {
- wp_redirect($login_page . "?login=empty");
- exit;
- }
- }
- add_filter('authenticate', 'qs_verify_user_pass', 1, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement