In this post, we’ll take a closer look at 🔎 the simple ways to make WordPress redirect after the login page. Let’s get started!
To get started, you may use the WordPress login redirect filter to help you create your specific redirect code and learn how the function works.
Here is an example of what it could look like:
function ti_custom_login_redirect( $url, $request, $user ) {
if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if ( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} else {
$url = home_url( '/cool-page/' );
}
}
return $url;
}
add_filter( 'login_redirect', 'ti_custom_login_redirect', 10, 3 );
This code works as follows:
- If an Administrator logs in, they’ll see the WordPress admin dashboard as usual.
- If any other user role logs in, they’ll be redirected to
https://yoursite.com/cool-page/
.
To customize this code snippet, replace /cool-page/ with the URL slug you want to redirect users to. For example, to set up a WordPress after login redirect to send users to https://yoursite.com/members/dashboard/, replace it with /members/dashboard/ (remember to keep the single quotes on both sides).
In the following part, we will demonstrate how to manually add this code to your WordPress site. However, you can inject the code without altering your site’s files by using a plugin such as Code Snippets.
First, install and activate the plugin. Then, navigate to Snippets > Add New, select the Functions tab, and paste the code right into the editor:

You can leave the option to Run snippet everywhere to redirect all
WordPress users on your site. Then click Save Changes > Activate.
Additionally, you may use more creativity and configure various WordPress redirection depending on the role of the user when they log in.
If you don’t want to use the Code Snippets plugin, you can simply add the above code snippet to your child theme’s functions.php file.
From your dashboard Appearance > Theme File Editor:
Enter the following code at the bottom of your theme functions file:
function ti_custom_login_redirect( $url, $request, $user ) {
if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if ( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} else {
$url = home_url( '/cool-page/' );
}
}
return $url;
}
add_filter( 'login_redirect', 'ti_custom_login_redirect', 10, 3 );
Then, click on Update File. And you’re done!

Go to the funcation.php and add the following code…
add_action('wp_logout','ps_redirect_after_logout');
function ps_redirect_after_logout(){
wp_redirect( 'Your redirect URL here' );
exit();
}
Now, click on the update file button. You are done.
How to Set Logout Redirect to the Homepage or Any Page
Using a Plugin (Simple and Easy)
WP Login and Logout Redirect