How to redirect users after logging into WordPress
When users login to a WordPress site the default action is to redirect them to the WordPress admin dashboard. This is fine if you are the site admin or the user needs access to the admin but what about when you don’t want your site’s users to be able to access the admin dashboard. WordPress core does not provide a way to redirect users.
The good news is plugins exist that will allow you to redirect them to a specific page on the front-end of your site. If you’re simply looking for a plugin that allows you to redirect users after logging in Peter’s Login Redirect plugin is a popular choice. However, in this article I’m going to show you how you can redirect users after logging in whilst using Ultimate Member.
Login redirects with Ultimate Member
Ultimate Member provides a lot of flexibility when it comes to redirecting users when they login. With the plugin you can choose from several actions for what happens when a user successfully logins. You can even redirect different user roles to different pages when they login (e.g Admin to dashboard and regular members to their profile).
Setting the login redirect
By default users will be redirected to their profile when they login to your site but if you want to change the redirect rule all you need to do is go to the login options widget when editing an existing user role or creating a new user role. In this widget you can set the action to be taken after a successful login.
The actions you can select from are: redirect to profile; redirect to url (a new field will appear when selected where you can paste a custom url); refresh active page and redirect to WordPress admin (default action for admin role).
Login redirect by user role
One of the best things about using Ultimate Member for login redirects is that you can customize the redirect action on a user role basis. This is extremely useful if you have a site where you require more than one user role.
For example you could create a job site with WordPress with two user roles: Job Seekers & Employers. By using Ultimate Member you can redirect these two separate user roles to a custom page which will allow you to tailor the experience for each user role e.g the job seekers are redirected to a page where they see the latest jobs whilst the employers are redirected to a page where they see a list of job seekers (using our member directory).
Login redirect by form
Ultimate Member also allows you to set login redirect rules on a per form basis. What this means is you can create additional login forms and give them a custom redirect rule which will override the user role redirect rule.
This can be useful if you want to add for example a login form to your blog posts sidebar which refreshes the page after the user logins whilst at the same time redirecting users to their profile when they login via the main login page.
Automatic login redirect on restricted pages
The plugin also provides a useful feature when logged out users try to access a restricted page/post. When a user tries to access a restricted page/post they will be redirected to login page and once they successfully login to your site they will be automatically redirected back to the restricted page/post.
Got a question?
If you have a question about login redirects or Ultimate Member in general feel free to post on our community forum where I will be more than happy to answer any questions you have!