How to Redirect the User to the Sign Up Page of the New Universal Login when Using the Auth0 WordPress Plugin

Overview
I'm using "Login by Auth0" WordPress plugin to authenticate users into my WordPress application. I'm redirecting the users to the New Universal Login page to log in. I need to provide a direct link to the Sign Up page to my users so they can easily Sign Up to my application.
Applies To
  • New Universal Login
  • Auth0 WordPress Plugin
  • Sign Up Page
Solution
By default, if you try to access the "/wp-signup.php" page of the WordPress instance, it will redirect the user to the "wp-login.php" page with the "action=register" query parameter in the URL. (https://YOUR_WP/wp-login.php?action=register). We can utilize this and the "auth0_authorize_url_params" filter to provide a direct link to the Sign Up page of the Universal Login Page. 

For example, you can add the following code to your WordPress theme's `functions.php` file.
 
function set_signup_to_auth0_url_params($params, $connection, $redirect_to) {
	if ($_GET['action'] === 'register') {
		$params['screen_hint'] = 'signup';
	}
	
	return $params;
}

add_filter('auth0_authorize_url_params', 'set_signup_to_auth0_url_params', 10, 3);
After that, visiting the /wp-signup.php URL or /wp-login.php?action=register will redirect the user to the Sign Up view of the Auth0 Universal Login Page.

You can read more about Extending Login by Auth0 Wordpress Plugin here - https://auth0.com/docs/customize/integrations/cms/wordpress-plugin/extend-login-by-auth0

Recommended content

No recommended content found...