Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Redirect already logged in users away from a page to a specific page base on user role

You can use admin_init to get this done. This hook fires when an admin page is starting to load and you can use it to redirect the user to a different page. Like this:

add_action('admin_init','wpse362882_redirect_login_page');
function wpse362882_redirect_login_page () {
  global $pagenow;
  if ( ($pagenow == 'wp-login.php') && is_user_logged_in() ) {
    .. do some stuff to determine $url to redirect user based on role ..
    wp_redirect($url);
    exit;
    }
  }

Related Posts:

  1. How to link that “logged in” in “you must be logged in to post a comment” with custom login page on WordPress?
  2. Redirection plugin – how to let the editor access the ‘redirection’ menu?
  3. SSL redirect loop using WordPress HTTPS Plugin
  4. Redirection Plugin: Redirect all URLs with a regular expression
  5. flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
  6. Can Not Redirect from Plugin-Registered Admin Page
  7. Detecting $_GET parameters from any page + Cookie
  8. How to send “Location” header on plugin form submit event?
  9. Custom url structure for custom template
  10. Login with email (WP Modal Login)
  11. wordpress custom login successful redirect hook
  12. Can’t access my WP dashboard: fatal error? [closed]
  13. How to redirect Old Post URL to new Post and keep Old post Comments?
  14. What’s the _wp_desired_post_slug value for?
  15. Redirect all blog links from WordPress.com site to new domain
  16. WordPress login with Phone Number [closed]
  17. how can I link to a PlugIn admin-sub-menu page after processing a formular
  18. How does automatic redirection for the redirection plugin work?
  19. Changed permalink structure. Need help with redirecting old posts
  20. WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
  21. Landing Page Redirect Chain | http->https->https www
  22. Is there an earlier hook than login_head or login_enqueue_scripts?
  23. How can I check if on specific plugin generated page or child
  24. Redirection based on location but without affecting search bots
  25. Page Restriction and Redirect for Particular Levels or user
  26. how to create site exit messages with destination url displayed
  27. How to redirect a URL with parameters?
  28. WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
  29. Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
  30. How to fix the woocommerce – adaranth.com redirection issue [closed]
  31. Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
  32. How to use login_redirect with a user capability
  33. Enqueue stylesheet in plugin for wp-login.php
  34. Removing Automatic Redirects Without Plugin
  35. WordPress 4.3 broke meta redirect (with url params plugin)
  36. Edit Permalink Structure For Custom Post Type or Modify .htaccess?
  37. Mask and Track Outbound Links
  38. How can I redirect some pages to new subdomain? [closed]
  39. Add to array, redirect and display
  40. Possibility to login without password
  41. Conditional custom redirect
  42. Making the ‘add to cart’ button redirect to PayPal
  43. PHP mobile redirect Endless loop
  44. How to force load a page in plugin?
  45. wp redirect 301 not working in wordpress page
  46. Preserve Search engine index while shifting to new Domain
  47. Janrain/Simple Modal under Redirected Domain
  48. Redirect unloggedin users
  49. login form should redirect to register page for in 1st login next time it should redirected to home page
  50. Identify User Language, Redirect to the corresponding page and Save the chosen language as Cookie
  51. www redirects to another directory in wordpress
  52. Hidden permalink different from displayed permalink
  53. redirect to homepage once action is completed
  54. Display value of the GET parameter in a new URL page
  55. Redirect to a page while maintaining search query parameters without causing an infinite loop
  56. Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
  57. wp_set_password() does not work!
  58. How to update all in-site redirect URLs to destination URLs at once
  59. How to send new visitor to a splash page for only one time in wordpress?
  60. WordPress Admin login redirect to homepage
  61. Why is my site still showing insecure icon even if I have SSL certificate?
  62. Reverse count page view and show on other page
  63. redirect to a custom page
  64. .htaccess file doesn’t work, with hundred tries
  65. Identify if the_post hook is being called from the admin post list
  66. Infinite 301 redirects after definitions in “Redirections” plugin?
  67. Clone a Post Tite and Custom Field into Custom Post type
  68. Direct URL to a template via plugin
  69. Redirect default login page to a custom page [duplicate]
  70. How to redirect from plugin page
  71. Template redirect inside of plugin not redirecting
  72. Can’t redirect to previous page after using GET
  73. Need to change contact email depending where user is from
  74. Redirect url in plugin to somewhere else?
  75. How do I to override login redirect on specific pages?
  76. Simple WordPress function / plugin to redirect a site
  77. How to validate password length in wordpress
  78. URL Redirect on GoDaddy platform [closed]
  79. Redirecting to page on form submit – Revue plugin
  80. how to make wordpress remember my choice
  81. Page with redirect
  82. Can’t change login logo & css – older plugin data blocking?
  83. Gravityforms login form custom redirect if form not submitted
  84. whole website redirected to another page
  85. Fatal Error in my WP “Call to undefined function get_option()”
  86. Show different page depending on user role
  87. add to cart linking to add to cart page
  88. How to force login on wordpress error
  89. wp_logout function not executed
  90. How to Include a Loop Template File in a Plugin
  91. Basic function call on init failing
  92. How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
  93. How to redirect wp_login_form to new page after user loged in?
  94. Plugin: connect to external database without showing password
  95. How to disable Wp-PageNavi at the top of the page
  96. What database state changes happen after a post is manually “updated” with no changes?
  97. custom fields not displaying on wordpress site
  98. How to update a database entry with a wordpress plugin?
  99. Storing values in Post Meta vs new tables
  100. Can i have limit posts on a specific category and automatically remove older ones?
Categories plugins Tags plugins, redirect, wp-login-form
How to programmatically customise the Contact Form7 notification email prior to sending? [closed]
Odd login issue that needs manual page refresh on some devices

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress