Facebook-f Twitter Flipboard Rss
EncodeByte
Newsletter
  • Home
  • How-To Guides
    How-To GuidesShow More
    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
    How do i permanently disable updates in windows 10?
    By EncodeMore
  • Tech Tips, Tricks & Productivity
    • WordPress & Website Development
    • Computer Tips & Tricks
    Tech Tips, Tricks & ProductivityShow More
    5 Effective Strategies to Boost Your Online Presence
    5 Effective Strategies to ImprYour Online Presence
    By Claire Wilson
    How To Set Up a Custom Domain in Blogger – The Right Way!
    By EncodeByte
    BEST Freelancing Websites to find work for Beginners to Find Work in 2024
    By Franchbabu
    Create Paypal Account in Bangladesh:
    How to Create Paypal Account in Bangladesh in 2023
    By Brazil Singh Rittik
    Voice Typing to Control Your Windows PC:
    How to Use Voice Typing to Control Your Windows PC | Best Feature in 2023
    By Brazil Singh Rittik
  • 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, and Affordability
    By Franchbabu
    Add “Made with Love” with a Heart to Your Footer
    By EncodeMore
    WordPress Redirect After Login: How to Set It Up
    By EncodeMore
  • Resource
  • 🤩 Trending:
  • How-To Guides
  • WordPress & Website Development
  • Web Development & Coding
  • Tech Tips, Tricks & Productivity
  • Windows & Software Fixes
  • Freelancing & Online Money Making
  • Computer Tips & Tricks
  • Uncategorized
  • Beginner Projects
  • Tutorial

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

Font ResizerAa
EncodeByteEncodeByte
Search
  • Home
  • How-To Guides
  • Tech Tips, Tricks & Productivity
    • WordPress & Website Development
    • Computer Tips & Tricks
  • Web Development & Coding
  • Resource

Popular Post

WordPress & Website DevelopmentHow-To Guides

How to Change WordPress Login URL

Web Development & Coding

SEO Tutorial for Beginners: A Step by Step SEO Guide

WordPress & Website DevelopmentHow-To Guides

Make a WordPress Website: An Easy, Free Step by Step Guide for Beginners in 2024

Web Development & CodingWordPress & Website Development

Essential Things To Do After Installing WordPress – Must Read!

Follow US
Made by ThemeRuby using the Foxiz theme. Powered by WordPress
Web Development & CodingWordPress & Website Development

WordPress Redirect After Login: How to Set It Up

EncodeMore
Last updated: July 30, 2024 2:15 am
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!


  1. 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 Flipboard Copy Link
Leave a Comment

Leave a Reply Cancel reply

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

Stay Connected

FacebookLike
XFollow
YoutubeSubscribe
Google NewsFollow

Categories

Must Read

WordPress & Website DevelopmentHow-To Guides

How to Change WordPress Login URL

Web Development & Coding

SEO Tutorial for Beginners: A Step by Step SEO Guide

WordPress & Website DevelopmentHow-To Guides

Make a WordPress Website: An Easy, Free Step by Step Guide for Beginners in 2024

Web Development & CodingWordPress & Website Development

Essential Things To Do After Installing WordPress – Must Read!

  • 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

WordPress & Website Development

The Best SEO Plugin For WordPress in 2024

Domain Name Generators
Web Development & Coding

2024’s Best Domain Name Generators Tool (Expert Pick)

Web Development & Coding

How to Choose the Best Domain Registrar in 2023

The Best Way to prevent WordPress from generating different image Sizes

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?