SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function 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','redirect_login_page');
  12.  
  13. function login_failed() {
  14.   $login_page  = home_url( '/login/' );
  15.   wp_redirect( $login_page . '?login=failed' );
  16.   exit;
  17. }
  18. add_action( 'wp_login_failed', 'login_failed' );
  19.  
  20. function verify_username_password( $user, $username, $password ) {
  21.   $login_page  = home_url( '/login/' );
  22.     if( $username == "" || $password == "" ) {
  23.         wp_redirect( $login_page . "?login=empty" );
  24.         exit;
  25.     }
  26. }
  27. add_filter( 'authenticate', 'verify_username_password', 1, 3);
  28.  
  29. function logout_page() {
  30.   $login_page  = home_url( '/login/' );
  31.   wp_redirect( $login_page . "?login=false" );
  32.   exit;
  33. }
  34. add_action('wp_logout','logout_page');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top