Facebook-f X-twitter
EncodeByte
Need Help!
  • How-To
    How-ToShow More
    How To Redirect Old Website To New Domain Without Losing SEO | 301 Domain Redirect
    By
    Franchbabu
    How to Fix the “Windows Cannot Be Installed to This Disk” Error
    By
    EncodeMore
    How to Check Your Laptop’s Battery Health: A Step-by-Step Guide
    By
    EncodeMore
    How to Become a Freelancer in 2025: A Comprehensive Guide.
    By
    EncodeMore
    How to Activate Windows Legally and For Free (100% Working)
    By
    EncodeMore
  • Web Development & Coding
    Web Development & CodingShow More
    How to Become a Freelancer in 2025: A Comprehensive Guide.
    By
    EncodeMore
    What Are the Top In-Demand Freelancer Niches Predicted for 2025?
    By
    EncodeMore
    🚀 10 Reasons Why Hostinger Is the Best Web Hosting Platform for Speed, Security & Affordability
    By
    Franchbabu
    How to Add “Made with ❤️” to Your WordPress Footer (No Plugin Needed)
    By
    EncodeMore
    WordPress Redirect After Login: How to Set It Up
    By
    EncodeMore
  • Code Snippets & Scripts
    Code Snippets & ScriptsShow More
    How to Hide a Class in WordPress (Easy CSS & Admin Tips)
    By
    EncodeMore
  • Website Design & UX
    Website Design & UXShow More
    10 Web Design Mistakes That Are Killing Your User Experience (and How to Fix Them)
    By
    Franchbabu
  • Make Money Online
    Make Money OnlineShow More
    How to Become a Freelancer in 2025: A Comprehensive Guide.
    By
    EncodeMore
    What Are the Top In-Demand Freelancer Niches Predicted for 2025?
    By
    EncodeMore
    Website related skillsets that you shoud have
    By
    EncodeMore
    Top Sites Like Fiverr: The Best Fiverr Alternatives for Freelancers
    By
    Franchbabu
    Best Telegram Channels For Free Paid Courses
    By
    Franchbabu
  • 🤩 Trending:
  • How-To Guides
  • WordPress & Website Development
  • Web Development & Coding
  • Windows & Software Fixes
  • Tech Tips, Tools & Tutorials
  • Computer Tips & Tricks
Font ResizerAa
EncodeByteEncodeByte
Search
  • How-To
  • Web Development & Coding
  • Code Snippets & Scripts
  • Website Design & UX
  • Make Money Online
Follow US
Made by ThemeRuby using the Foxiz theme. Powered by WordPress
Web Development & CodingWordPress Tutorials

WordPress Redirect After Login: How to Set It Up

Last updated: July 30, 2025 2:27 pm
By
EncodeMore
Share

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:

  1. If an Administrator logs in, they’ll see the WordPress admin dashboard as usual.
  2. 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!


How to Set Logout Redirect to the Homepage or Any Page
Using a Plugin (Simple and Easy)
WP Login and Logout Redirect

    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.

    TAGGED:WordPressWordPress Tricks
    Share This Article
    Facebook Whatsapp Whatsapp LinkedIn
    Leave a Comment

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Popular Categories

    Themes & Customization

    1 Article

    Troubleshooting & Fixes

    1 Article

    WordPress Tips & Tricks

    6 Articles

    WordPress Tutorials

    5 Articles

    Must Read

    How-To GuidesSEO Tips & StrategiesWordPress Tutorials

    How To Redirect Old Website To New Domain Without Losing SEO | 301 Domain Redirect

    WordPress & Website DevelopmentHow-To Guides

    How to Create a Private/Password Protected Post or Page in WordPress

    Computer Tips & TricksHow-To Guides

    How to Repair a Bad Hard Disk (Hard Disk Low Level Format)

    How-To GuidesTech Tips, Tools & Tutorials

    How to Remove URLs From Google Search

    • I need help with …

    Starting a Blog

    WordPress SEO

    WordPress Performance

    WordPress Errors

    WordPress Security

    Got A Question?

    Need Expert Help?
    Let CodeXcool power up your website with
    custom WordPress design, speed optimization, and SEO!
    🚀 Get Started

    You Might also Like

    HTML Link Color
    Front-End Development

    HTML Link Color

    WordPress & Website DevelopmentBeginner ProjectsHow-To Guides

    How To Disable Emojis In WordPress

    WordPress & Website DevelopmentHow-To Guides

    How to Reset WordPress Admin Password From cPanel

    What Are the Top In-Demand Freelancer Niches Predicted for 2025?

    EncodeByte

    © 2025 EncodeByte – Discover expert tech tutorials, coding guides, troubleshooting solutions, and free tools. Simplify technology, build smarter, and learn faster with us.

    About Us / Privacy Policy / Contact Us

    Latest News

    • Coming Soon
    • Coming Soon
    • Coming Soon
    • Coming Soon

    Services

    • Coming Soon
    • Coming Soon
    • Coming Soon
    • Coming Soon

    Looking for custom web development or maintenance?

    Check out our parent team at [CodeXcool.com] 🚀
    — Let's build together!
    Request a Quote
    Welcome Back!

    Sign in to your account

    Username or Email Address
    Password

    Lost your password?