Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /* Main redirection of the default login page */
  2. function qs_redirect_login_page() {
  3. $login_page = home_url('login');
  4. $page_viewed = basename($_SERVER['REQUEST_URI']);
  5.  
  6. if($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
  7. wp_redirect($login_page);
  8. exit;
  9. }
  10. }
  11. add_action('init','qs_redirect_login_page');
  12.  
  13. /* Where to go if a login failed */
  14. function qs_custom_login_failed() {
  15. $login_page = home_url('login');
  16. wp_redirect($login_page . '?login=failed');
  17. exit;
  18. }
  19. add_action('wp_login_failed', 'qs_custom_login_failed');
  20.  
  21. /* Where to go if any of the fields were empty */
  22. function qs_verify_user_pass($user, $username, $password) {
  23. $login_page = home_url('login');
  24. if($username == "" || $password == "") {
  25. wp_redirect($login_page . "?login=empty");
  26. exit;
  27. }
  28. }
  29. add_filter('authenticate', 'qs_verify_user_pass', 1, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement