How I Redirect Users After Login in WordPress Without a Plugin
There are times when you need to control where users land after logging into your WordPress site. On a project at Blueinc Technologies, we had to redirect subscribers straight to a custom dashboard page, but the client didn’t want any plugins installed for this simple task.
Here’s exactly how I handled it using a small PHP snippet.
First, go to your WordPress dashboard and navigate to Appearance > Theme File Editor. In the sidebar, find and open the functions.php file of your active theme.
At the very bottom, paste this code:
function custom_login_redirect( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
if ( in_array( 'subscriber', $user->roles ) ) {
return home_url( '/dashboard/' );
}
}
return $redirect_to; }
add_filter( 'login_redirect', 'custom_login_redirect', 10, 3 );
Now, every time a user with the “subscriber” role logs in, they’ll be redirected to yourdomain.com/dashboard/ instead of the default WordPress admin area or homepage.
We use this method regularly because it’s clean, efficient, and avoids plugin bloat. You can adjust the URL and user role to fit any kind of custom flow you need.
If you’re working on custom login flows for WordPress and need help setting up advanced redirects, our team at Blueinc tech is always open to sharing ideas. Feel free to reach out via our website if you’d like to discuss similar setups.