Redirect WordPress Users After Login, Logout to Custom Page
When ProfilePress is installed and activated, the custom pages it creates for login, registration and password reset are automatically set as WordPress default. Thus when users visit the following URLs:
They will be redirected to the page containing the custom login, registration and password reset form created by ProfilePress.
To alter these pages settings, click the Settings ProfilePress menu and go to the
Global Settings section.
To redirect users to a custom page or URL after they log in and log out, select the pages or enter the URL in
Redirection section and save.
Note: URL entered into the custom URL field takes precedence over a selected page.
You can also set custom redirect per login and registration shortcodes via the
For example, a custom login page with the shortcode below will redirect users to the URL https://xyz.com/welcome after they are logged in.
[profilepress-login id="2" redirect="https://xyz.com/welcome"]
Similarly, a registration page with the shortcode below will log users in and redirect them to the https://xyz.com/welcome after they successfully create an account.
[profilepress-registration id="1" redirect="https://xyz.com/welcome"]
If you don’t want users to be logged in before the redirect happens, change “redirect” to “no-login-redirect” like so:
How about if you wish to redirect unregistered or non-logged-in users to your website login page when they try to access a post or page; use the following shortcode on the said post or page.
If you want them redirected to a custom URL, use the shortcode like so:
To redirect only logged in users to a custom URL, use the following shortcode:
Remember, if the user isn’t logged in, no redirection will occur. And omitting the
url attribute will cause the user to be redirected to the login page.