How to Redirect Users after Successful Login in WordPress
Have you ever wanted to redirect users to a specific page after they login to your WordPress site? Recently one of our users asked if it was possible to redirect logged-in users to a specific page based on their user role. In this article, we will show you how to redirect users after successful login in WordPress.
First thing you need to do is install and activate the Peter’s Login Redirect plugin. Upon activation, you need to visit Settings » Login/logout Redirects to setup the plugin.
Setting Login/Logout Redirect by Username in WordPress
The first option on the settings page allows you to redirect only specific users. You can select a username from the drop-down menu. After that you can enter the URLs to redirect a user on login and logout.
Click on the Add username rule button to store this setting. Remember, you can always come back to the settings page to edit or remove a redirect rule.
Setting up Login Redirect by User Role in WordPress
You can also set up a login redirect based on user role in WordPress. Simply select a user role from the drop down list and then enter the redirect URL. For example, you can redirect editors to the admin-area and subscribers to a custom page.
Setting up Login Redirect by Capabilities in WordPress
The plugin also allows you to set up login redirects based on user levels and capabilities. This option is particularly useful if you are using user roles with custom capabilities in WordPress.
Simply select a user level from the drop down menu and enter login and logout URLs.
Setting up Login Redirect for All Users in WordPress
On the plugin’s settings page, there is an option to set redirect for All Other Users. If a user does not match any rules you set above, then you can redirect them by entering a URL here.
You can also use this setting to set up a site-wide redirect for all users by not setting any other redirects.
Redirecting Users After Registration in WordPress
When a new user signs up on your site, WordPress redirects them to the login page. You can set up a redirect URL to send them to any other page on your site under the Post Registration section.
For example, you can redirect them to a welcome page with links to different things they can do on your website.
Important: Do not forget to change permission level under ‘Customize plugin settings’ section. The plugin allows anyone who can edit categories to edit redirect URLs. This means a user with the Editor user role can set up redirects. Change this to
install_plugins, so that only users with administrator role can setup redirects.
We hope this article helped you redirect users after successful login in WordPress. You may also want to checkout our guide on how to create a custom login page for WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.