You can automatically redirect users to a custom page after they successfully log in to your WordPress website. This is useful when you want users to land on a dashboard, account page, or another specific section instead of the default WordPress location.
Steps
- Add the code below to your theme’s
functions.php. - Change the destination URL.
- Save the changes.
- Log in to your WordPress website and test the redirect.
/**
* Redirect users after WordPress login
*/
function custom_login_redirect( $redirect_to, $requested_redirect_to, $user ) {
if ( ! is_wp_error( $user ) ) {
return home_url( '/dashboard/' );
}
return $redirect_to;
}
add_filter(
'login_redirect',
'custom_login_redirect',
10,
3
);
Tested on
WordPress 7.1
Reported by the author on September 23, 2026. WPFolks has not verified this.