WordPress Redirect After Login and Registration: Easy Tutorial

If you own a WordPress site that allows front-end user registration you’re probably looking for an easy way to set up a WordPress redirect after login or registration. Not only does this let you keep users out of the WordPress dashboard, but it also lets you send them straight to a specific page that you’ve optimized for them.

pb-custom-user-redirects

Using the new and improved Custom Redirects module in the Profile Builder plugin, you can set up a custom WordPress redirect after login, as well as a number of other situations.

In this tutorial, we’ll go through all the different types of custom redirects you can set up with this redirect plugin module.

What is the Profile Builder plugin?

If you’re not familiar with the Profile Builder WordPress plugin, it’s an easy-to-use plugin that lets you improve all aspects of your WordPress login and registration process.

You can create custom registration forms to collect additional information about your visitors, as well as front-end profile editing pages so that users can manage their own profiles. You can also create a custom login page at a custom URL on your site.

And, with the Custom Redirects module, you can also easily set up a WordPress redirect after login.

Profile Builder Pro

Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.

Get the plugin

Once you install and activate the Profile Builder plugin and its Custom Redirects module on your WordPress site, you can set up a WordPress redirect after login by going to Profile Builder -> Custom Redirects and using the settings page:

How to set up a WordPress redirect after login

Now, let’s cover the different redirect types…

Types of WordPress User Redirects in Profile Builder

The Custom Redirects module in Profile Builder gives you several redirection methods for various user actions related to login and registration:

  • After Login – redirect users to a custom redirect URL after they log in
  • After Logout – create a logout redirect that sends people to a custom URL when they log out
  • After Registration – redirect users after successful front-end registration by a new user
  • Dashboard – redirect users when trying to access the WordPress dashboard
  • After Edit Profile – redirect users to a custom page after they edited their front-end user profile
  • After Password Reset – to redirect users after they have successfully changed their password
  • After Email Confirmation – to redirect users after confirming their email address

Choose redirect types for WordPress redirect after login
Now that we listed the type of user actions where we can apply our custom redirects, we’ll look into how to use redirect rules to target only certain users, based on redirect filters like user role, username or user ID.

WordPress Redirect After Login Based on Username or User ID

One of the most focused types of user redirects is when you need to target only a specific user’s username or specific user IDs.

WordPress redirect after login based on user id

Under Custom Redirects -> Individual User Redirects you’ll be able to select which users are redirected to which link after a certain action. You can target a specific user by entering his username or user ID.

WordPress Redirect After Login Based on User Role

Let’s say you have a registration form where users can select their user role (using the User Role Select field) and you want different roles to be taken to different pages after registration.

cr3

Or in case you allow users to sign up for paid accounts using Paid Member Subscriptions in combination with Profile Builder, they will automatically get the user role of the selected subscription plan at registration. This means users selecting different plans will have different user roles.

WordPress redirect after login based on user role
By setting up custom redirects based on user role, you can choose where to redirect users based on which membership plan they applied for at registration.

As you can imagine, the use cases for redirecting users based on user role are countless.

Global WordPress Redirects

These redirects rules are applied globally, when there are no more specific redirect rules defined, like redirects based on username or user role.

cr4

Redirect Users on Default WordPress Pages

Besides the front-end user redirects listed above, you’ll probably want to keep your users from seeing or accessing the (backend) default WordPress pages like:

  • Login (wp-login.php) – redirect users to the front-end login form created with Profile Builder
  • Register (wp-login.php?action=register) – redirect users to the front-end Profile Builder register form
  • Lost Password (wp-login.php?action=lostpassword) – redirect users to the front-end lost password form
  • Author Archive (http://sitename.com/author/admin) – this has been a common request from Profile Builder users, to be able to redirect people trying to access an author archive to that author profile page, basically the single userlisting template.

cr5

The new Custom Redirects module from Profile Builder has also a list of available tags which can be used for creating dynamic URLs:

  • {{homeurl}} – generates a URL of the current website homepage.
  • {{siteurl}} – in WordPress the site URL can be different than the home URL
  • {{user_id}} – the ID of the user
  • {{user_nicename}} – the URL sanitized version of the username, the user nice name can be safely used in URLs since it can’t contain special characters or spaces.
  • {{http_referer}} – the URL of the previously visited page

Custom Redirects Priority

Which redirect happens depends on the following priority:

  1. Individual User Redirects
  2. User Role based Redirects
  3. Global Redirects
  4. Individual redirects defined in shortcodes or in the Multiple Registration and Edit Profile form settings. (redirect_priority=”top” parameter can be added in any shortcode, then that shortcode redirect will have priority over all other redirects)

Set Up WordPress Redirect After Login Functionality Today

With Profile Builder Pro and the Custom Redirects module, you can easily set up a WordPress redirect after login along with detailed redirect rules for specific usernames, user roles, and more.

To get started, purchase Profile Builder Pro and start setting up redirects for various user actions.

Profile Builder Pro

Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.

Get the plugin

Related: Manage WooCommerce Customer Fields with Profile Builder

Subscribe to get early access

to new plugins, discounts and brief updates about what's new with Cozmoslabs!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.