PHPMatters Help You Better Hosting Your PHP-based Sites
How to Redirect Users Automatically After WordPress Login

How to Redirect Users Automatically After WordPress Login

redirects users after loginBy default, there are 6 user roles available for your WordPress website and each one performs its own functions. On account of such an otherness, you may wish to redirect users to different locations since they log into WordPress, for which has been recognized as an effective method to help users work better on your website.

To do so, we make an in-depth guide on how to automatically redirect users after logging in WordPress by using a WordPress plugin. Here, we select Peter’s Login Redirect in this tutorial to help you settle the matter in a breeze.

Peter’s Login Redirect enables a set of redirect rules for specific users to lead them to specific locations as planned. This plugin allows you to make use of [variable]username[/variable] and generate a dynamic URL for each login. You just need to replace the username to a certain user’s name who will be included in the redirection. After having a rough idea about this powerful plugin, let’s give it a try and enable it for you website.

Install & Activate Peter’s Login Redirect Plugin

Here, we suggest you to have this plugin installed and activated via WordPress dashboard. Log into your website admin and search for Peter’s Login Redirect via Plugins > Add New. The search result should be like the following screenshot. Click “Install Now” and then “Activate Plugin” to make it work properly.

install peter's login redirect

Since there is a new item called “Login/logout redirects” coming to Dashboard > Settings, you have successfully enabled Peter’s Login Redirect for your website.

login and logout redirects

Redirect Users After Login with Peter’s Login Redirect

Go to Settings > Login/logout redirects and access to the Peter’s Login Redirect setting page. There are several options available for you to redirect users to different locations, including Specific users, Specific roles, Specific levels, All other users and Post-registration. We are going to brief you on those sections one by one.

Specific users

As the name suggests, the first mode “Specific users” just enables you to redirect specific users when they log into your website, which is a great option for multi-user website. Select the targeted username from the “Add” drop-down list and fill out the URL where to welcome this user when he/she logs in.

Besides, the “Logout URL” field allows you to redirect the user to a certain page when he/she logs out your website. Click “Add username rule” to confirm all information.

specific users

Specific roles

“Specific roles” is where to redirect a certain user role to a specific location since he/she logs into your WordPress website. There are 5 user roles available in the drop-down list by default, including administrator, editor, author, contributor and subscriber. You are required to select one user role from the five options and give the URL where the selected role should be redirected to.

Likewise, fill out a logout URL to the second field so as to redirect the targeted users to this page when they log out. Click “Add role rule” to complete the above settings.

specific roles

Specific levels

By default, there are multiple capabilities available for the users to manage your website, such as activate_plugins, create_users, edit_files, and so on. The “Specific levels” is where to redirect certain users to a specific location according to user capabilities. Select a level from the drop-down list and then fill out URL and logout URL in the fields respectively.

For example, if you plan to redirect users with the capability of “create_users” to WELCOME page after login, then you should select “create_users” from the drop-down list and fill out the WELCOME page URL in the URL field as the following screenshot. Note that, the Order field is where to specify the superiority of this redirection. Finally, “Add Level Rule” to make the newly created redirection into effect.

specific levels

All other users

“All other users” mode allows you to redirect all the users who don’t match the rules set before to a certain page. That is to say, in addition to the specific users who have been redirected to certain locations, the left user roles are redirected to a single location together. Fill out the URL and logout URL as what you have done in the above steps.

Perhaps, you can leave all the options mentioned above and just specify URL and logout URL via “All other users” mode. In this case, all users are redirected to the same web page with no difference.

all other users

Post-registration

“Post-registration” is where to redirect users to a specific location after registration and log into WordPress for the first time. We suggest you to create an awesome landing page to welcome those new comers and then enter the page URL to the URL field as required. Click “Update” button to confirm this command.

post registration

Customize plugin settings

This mode enables you to enjoy more functions of Peter’s Login Redirect. There are several customizable options included in “Customize plugin settings” section, which help you set redirect restrictions and determine whether to use external redirect file. Besides, it is also a great option for better user permissions control.

The last item called “Permission level required to edit redirect URLs” is used to specify who can edit redirect URLs according to capability type. Select the most suitable type as needed and then click “Update” button to confirm all settings.

customize plugin settings

More Recommendations for You

If you wish to have a shot at more plugins to achieve the same goal, you can refer to the following recommendations as well. Here, we list some popular options for you to choose from, which help you redirect users after login to specific locations with ease. Those options also come with high level of usability and perform as well as Peter’s Login Redirect plugin.

  • Login Redirect URL – This plugin allows you to redirect certain users to a specific URL or page after login in a simple way. All processes are competed via an intuitive interface where you can create new login redirection or edit the existing one if needed.
  • Sky Login Redirect – This plugin brings users to the page that they have read last time when they try to log into WordPress. And then, it automatically redirects users to the homepage when they log out. It is understandable and easy to handle.
  • Simple Membership After Login Redirection – This plugin enables a simple configuration for an after login page, which is especially suitable for membership website. Once installing this plugin, you are able to redirect every member to certain location since he/she log into your website. Undoubtedly, it is a great method to provide users with better user experience.