Redirect users to a front end wp login page


My theme allows me to create a front-end login form in a normal blog page. Now, I wish to redirect all the users to that page and not to wp-login.php. I have used the below code snippet.

function redirect_login_page(){
   $page_viewed = basename($_SERVER['REQUEST_URI']);
   // Where we want them to go
   $login_page  = '';
   if( $page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {

But the problem is, it only redirects wp-login.php page. What if we place wp-admin, (e.g. it does not redirect. Instead it takes to that wp-login.php page (which I do not want)

Any suggestions?

kalyan 2 months 0 Answers 11 views 0

Leave an answer