Problem statement
I use the “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 so users can sign up easily.
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.