support@yoohooplugins.com
  • ACCOUNT
  • BLOG
  • LOG IN
  • LOG OUT
Yoohoo Plugins
  • HOME
  • PLUGINS
  • SUPPORT
    • DOCUMENTATION
    • FAQ
  • CHECKOUT
    • PURCHASE HISTORY
Select Page

Redirect Users After Login for WordPress

Redirect users after login header image.

This is a topic that seems to pop-up a lot for WordPress plugins that offers user management features or something similar. A lot of support threads consist of questions similar to “How can I redirect users after login for my WordPress website” or “Can I redirect user’s according to their WordPress user role”. One great thing about WordPress is it’s vast range of free plugins that are absolutely amazing.

In this blog post, you will find out about some of the plugins that easily do this for you and a simple code example which should be a great starter point if you are wanting to get into development. Here is a list of some of our recommended WordPress plugins that will redirect users after login:

Theme My Login (TML)

Theme My Login is my most preferred plugin as this offers more than just a simple redirect after login feature. Some of it’s features include front-end registration, login and disable the dashboard for users with certain roles. Our site makes use of this plugin for some of these features, this is ideal if you want to hide the fact that your site is a WordPress based website to your users.

Theme My Login

Redirect After Login

This plugin says what it does. You can create custom page redirects after a user logs into your WordPress website and is ideal if this is the only feature you would need.

Redirect After Login

Peter’s Login Redirect

Similar to Redirect After Login, Peter’s Login Redirect does what it says and is another alternative to the previous plugins mentioned above.

Peter’s Login Redirect

Something For The Developers

So I’ve gotten to a point in my career where I love to code, as you can tell by the many plugins we’ve released and still plan to release, and I absolutely love to figure out how other developers would tackle scenarios and learn from that. Something as simple as to redirect users after login might be easy for some and a mountain for others – I’m more than happy to share and explain code.

This code may seem intimidating for some developers but once you get the hang of WordPress hooks and functions, it will seem rather simple. The $user object is passed in through the login_redirect filter which means the current user’s data that is logging in will be available. This means that you will be able to redirect user’s after login not only by user role but by any other data linked to that user’s account, such as user_meta .

The additional checks of is_array and isset is just to ensure that the data exists before trying to see if the user is not an administrator and this is done on line 12 of the gist, by checking to see if the user role is not administrator.

Some of the code was taken from the login redirect documentation, an interesting note is that the $current_user global is not available on this filter and you may need to rather use the $user object that is passed in the filter or the $user global instead.

Where To Now?

I hope this blog was helpful and the code is clearly understandable for developers of all levels, including developers just starting out. As you may know there are many ways to achieve the same result and you may be interested in looking into the wp_login filter. If you are looking to code, why don’t you try redirect user’s after login and hook into When Last Login’s custom login action called wll_logged_in_action which can be found over here: https://github.com/andrewlimaza/when-last-login/blob/master/when-last-login.php#L300

15% off,

just for you 🎁

Sign up to receive your exclusive discount, and keep up to date on our latest news, products & offers!

We don’t spam, ever! Read our privacy policy for more info.

Check your inbox to confirm your subscription.

Submit a Comment Cancel reply

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

Secure checkout with instant delivery Safely purchase products through PayPal or Stripe. Purchase with confidence.
PayPal Acceptance Mark Powered by Stripe

14 DAY MONEY BACK GUARANTEE

Cart

Number of items in cart: 0

  • Your cart is empty.
    Add a product to your cart to checkout.

  • Total: $0
  • Checkout

CART

Number of items in cart: 0

  • Your cart is empty.
    Add a product to your cart to checkout.

  • Total: $0
  • Checkout

USEFUL LINKS

  • ABOUT
  • SUBSCRIBE
  • ALL ACCESS PASS
  • INDIE HACKERS
  • LOGIN
  • LOG OUT

Recent Articles

  • Increase Sales Through Clear and Reliable Lead Time Estimates
  • How To Back Up WordPress
  • How To Accept Donations With WooCommerce
  • Connect MailPoet to Zapier
  • Paid Memberships Pro – PDF Invoices V1.11 update log
  • DOCUMENTATION
  • SUPPORT
  • TERMS OF SERVICE
  • LICENSING POLICY
  • PRIVACY POLICY
  • SUPPORT POLICY
  • Facebook
  • X
© 2017-2025 Yoohoo Plugins . All Rights Reserved. | An Arctek Technologies (Pty) Ltd project | Built in South Africa with ❤️