You’ve got users with different needs. So you want to redirect them straight to the right place as soon as they login. Stop using a plugin that will display ads or will make an update one day that breaks your sites (happened to me today 🙁 ) (so I made this snippet).
Redirect your users upon login based on user roles. Easily add/remove/edit the custom roles and redirection rules. Include dynamic data, such as {{username}}
, {{user_id}}
, and more, including user meta with {{user_meta:META_KEY_HERE}}
.
*Notes: This class assumes that each user has only one role. If a user has multiple roles, they will be redirected based on the first role found in their role list. Also, be aware of privacy considerations when using tokens like {{user_email}}
and {{user_ip}}
, as these could potentially expose sensitive user information.
Leave a Reply