Skip to content

Instantly share code, notes, and snippets.

@mayeenulislam
Created September 21, 2015 12:28
Show Gist options
  • Save mayeenulislam/2232203bcdfb2bc495dd to your computer and use it in GitHub Desktop.
Save mayeenulislam/2232203bcdfb2bc495dd to your computer and use it in GitHub Desktop.
wp-login.php page redirect
<?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