Changes between Initial Version and Version 1 of Ticket #61746, comment 1
- Timestamp:
- 07/24/2024 07:29:05 PM (6 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #61746, comment 1
initial v1 8 8 9 9 function custom_login_redirect($redirect_to, $request, $user) { 10 // Check if the user object is a WP_User instance 11 if (isset($user->roles) && is_array($user->roles)) { 12 // Check user role and redirect accordingly 13 if (in_array('administrator', $user->roles)) { 14 // Redirect administrators to the admin dashboard 15 return home_url('/dashboard/'); 16 } else { 17 // Redirect other users to a specific page 18 return home_url('/dashboard/'); // Change /custom-page to your desired page 19 } 20 } else { 21 // Default redirect 10 22 11 return home_url('/dashboard/'); 23 } 12 24 13 } 25 14