wordpress set two login url links

<?php
//if you want to show two (different) login pages for two (different) links,
//you can first of all think of two urls for two different login pages.
//here, i have two links =>  /login-old  and  /login-new for which i want different forms,
//now as any of these url hits the browser, i will check for url paramenter 

	$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];

	if (strpos($url,'login-new') !== false) {
	    // echo 'to New Login page';
	    $cookie_name = "login_page";
		$cookie_value = "new";
		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
    	header("Location: ".site_url('login'));  //this will be your default  login page url
		exit;
      
	} else if(strpos($url,'login-old') !== false) {
    	// echo 'to Old Login page';
	    $cookie_name = "login_page";
		$cookie_value = "old";
		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
    	header("Location: ".site_url('login'));  
		exit;
    }

//now that the cookie is set, i know which form to show to user,   
//now, as the user gets redirected to default login page, go to it's template file
//and check for the default login form, where, check,

$login_page = '';
if (isset($_COOKIE['login_page'])) {
	$login_page = $_COOKIE['login_page'];
}

if ($login_page == 'new') {  ?>
  <style>
  #your new form styling here...
  </style>
<?php } else if ($login_page == 'old'){ ?>
  <style>
  #your old form styling here...
  </style>
<?php }

if ($login_page == 'new') { ?>
  <form id="new_form" action="" method="post"> </form>
<?php } else if ($login_page == 'old'){ ?>
  <form id="old_form" action="" method="post"> </form>
<?php } 
//here, check the default login form action attr to put above in our custom forms 
 

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
wordpress set login url to a button wordpress different login url how to follow the permalink in wordpress after the login page wordpress sign in from url wordpress where is the login page wordpress change login page custom wp login url how to find nonstandard wordpress login page wordpress admin login location wp login page changed how to change url when someone logs in in wordpress how to find the wordpress login page how to chnage login page link in eoocommerce wordpress set referer url modify wp-login url change wp-login url wp password page url login custom login page wp url wordpress login in one site to another wordpress admin login url wordpress change wp-login url how to get a wordpress login url how to make wordpress login default page inurl: login panel wp rewrite login page url wp rewrite url rout for login page wp admin login url wordpress change the default wp login url how to change wp login url in wordpress wordpress change login to my account change login url in wordpress change login url wordpress custom login url how to change the login form on wordpress changed the wp-login to another url can't remember wordpress move login screen login url change wordpress change wp login url how to find the login url for wordpress site change sign up link wordpress wordpress change login destination wordpress change default login RU wp function set detault login url to my custom login url switch wordpress site to login page wordpress change login url wordpress find admin url cmdline change wordpress login page custome link for login change the login page wordpress url custom login url wordpress wordpress login page chage how to change the wordpress login url wp login url change wordpress default login url login url wordpress find login url wordpress plugin change login url change default login page wordpress change wordpress login url change wp-admin login url how t change wp login url how to change wordpress login url wordpress login url wordpress set two login url wordpress multiple login urls pages php wordpress set two login url links
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source