Created
September 21, 2015 12:28
-
-
Save mayeenulislam/2232203bcdfb2bc495dd to your computer and use it in GitHub Desktop.
wp-login.php page redirect
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 | |
/** | |
* Redirect from wp-login.php | |
* @link http://stackoverflow.com/a/1976804/1743124 | |
*/ | |
function mayeenulislam_wp_login_redirect(){ | |
if( isset($_GET['action']) && $_GET['action'] == 'register' ) { | |
wp_redirect( home_url('/register') ); //i.e. http://example.com/register | |
exit(); | |
} else if( isset($_GET['action']) && $_GET['action'] == 'lostpassword' ) { | |
wp_redirect( home_url('/reset-password') ); //i.e. http://example.com/reset-password | |
exit(); | |
} else { | |
wp_redirect( home_url('/login') ); //i.e. http://example.com/login | |
exit(); | |
} | |
} | |
add_action( 'login_head', 'mayeenulislam_wp_login_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment