In many cases, you may want to redirect users to a custom page after they log in or log out of your WordPress site. Whether it’s redirecting users to a dashboard, shop, homepage, or a custom thank-you page—WordPress makes it possible with a few simple steps.
In this guide, we’ll show you how to set custom login and logout redirects in WordPress — both with a plugin and using a code snippet.
🚀 Why Redirect After Login/Logout?
Redirects help improve:
- ✅ User experience – guide users to the most relevant page.
- ✅ Security – prevent default WordPress admin access.
- ✅ Conversions – redirect to a sales page or lead magnet.
- ✅ Membership or eCommerce flow – send users to dashboards or thank-you pages.
🔧 Method 1: Using a Plugin (No Code Needed)
The easiest way is to use the “LoginWP” (Formerly Peter’s Login Redirect) Plugin.

👉 Step-by-Step:
The LoginWP plugin makes it easy to redirect users after login and logout. Here’s how to use it:
Step 1: Install and Activate the LoginWP Plugin
- Log into your WordPress dashboard.
- Navigate to Plugins → Add New.
- Search for “LoginWP” and click Install and Activate.
Step 2: Set Custom Redirects

- After activating, go to LoginWP → Redirections.
- Click Add New to create a new redirection rule.
- Select the User Role or User Capability to create custom redirects for different roles (e.g., subscribers, customers, admins).
- Enter the Login Redirect URL and Logout Redirect URL.
- Save the changes.
✅ That’s it! Now, users will be redirected to your specified pages based on their role after login or logout.
Key Features of LoginWP:
- Set redirects for different user roles.
- Customize redirects for individual users.
- Redirect users after login, logout, and registration.
#2 Redirects Using WPForms with the User Registration Addon
For those using WPForms for custom login forms, you can set redirects after users log in or register on your site.
Step 1: Install WPForms and the User Registration Addon
- Go to your WordPress dashboard → WPForms → Addons.
- Install the User Registration Addon.
- Create a custom login form by navigating to WPForms → Add New, then select the User Login Form template.
Step 2: Set Up Redirect for Login Forms
- In the WPForms form builder, go to Settings → Confirmation.
- Choose Go to URL (Redirect) as the confirmation type.
- Enter the custom page URL where you want users to be redirected after login.
- Save your changes.
This method allows you to control exactly where users go after submitting a login or registration form on your WordPress site.
💻 Method 2: Use Custom Code (No Plugin)
If you want a lightweight solution without plugins, you can add a code snippet to your theme’s functions.php
file or a site-specific plugin.
✍️ Login Redirect Code:
function custom_login_redirect( $redirect_to, $request, $user ) {
// Check if user is valid
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
// Redirect admins to dashboard
if ( in_array( 'administrator', $user->roles ) ) {
return admin_url();
} else {
// Redirect other users to homepage
return home_url('/welcome');
}
}
return $redirect_to;
}
add_filter( 'login_redirect', 'custom_login_redirect', 10, 3 );
✍️ Logout Redirect Code:
function custom_logout_redirect() {
wp_redirect( home_url( '/goodbye' ) );
exit();
}
add_action( 'wp_logout', 'custom_logout_redirect' );
⚠️ Tip: Always back up your site before adding code.
🧩 Bonus: WooCommerce Redirects
If you’re using WooCommerce, plugins like “NextMove” or “WooCommerce Redirect After Login/Logout/Registration” allow more control over customer flow.
✅ Final Tips
- Create meaningful landing pages like
/dashboard
,/welcome
, or/thank-you
. - Use role-based logic to tailor the experience for admins, customers, or members.
- Test your redirects thoroughly after setup.
📌 Conclusion
By setting up custom login and logout redirects in WordPress, you gain full control over user flow and user experience. Whether you use a plugin or code, the setup is easy and effective.
Want more step-by-step WordPress tutorials? ✅ Follow EncodeByte.com for the latest guides, tips, and tricks to supercharge your website!
Frequently Asked Questions
Q1: Can I redirect users to different pages based on their role?
Yes, plugins like LoginWP allow you to create role-based redirects, ensuring that each user role is redirected to a relevant page.
Q2: What happens if I update my theme after adding custom code?
If you manually add custom code to the functions.php
file, it will be lost when you update your theme. To avoid this, use a child theme or the Code Snippets plugin to preserve your customizations.
Q3: Are there any security concerns with redirecting users?
As long as you implement redirects correctly, there are no significant security risks. Always ensure that redirect URLs are valid and do not expose sensitive information.
Feel free to share this guide or drop a comment below if you have any questions!