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

Conditional redirect on login using referring URL

just use the login_redirect filter and return RSVP form page permalink.

add_filter( "login_redirect", "redirect_on_login", 10, 3 );
function redirect_on_login( $redirect_to, $requested_redirect_to, $user ) {
    // check the user's role
    $role = $role = array_shift($user->roles);
    if( $role == "custom-role" ) {
        return get_permalink(/* post/page id of RSVP Form */);
    }
}

Related Posts:

  1. Redirect user to original url after login?
  2. Login redirect to previous page
  3. Redirect to referring page after logging in
  4. check first time login only
  5. How to change the default logout link on WordPress Admin
  6. How to redirect after login, the working way?
  7. Password change when the user login first time
  8. Custom login form redirect to external site
  9. handling login/logout redirects
  10. Redirect After Delete User in Backend
  11. Restrict Access to wp-login.php
  12. Using `auth_redirect` : keeps asking me to login even when I’m logged in
  13. after login that will redirect user role into a page
  14. Redirect users after first login
  15. Redirect to current page after wordpress login
  16. wp-login.php — redirect logged in users to custom URL
  17. Redirect to login page
  18. You do not have sufficient permissions to access this page
  19. Redirect user after logout
  20. wordpress custom login successful redirect hook
  21. How to redirect user to specific page based on the input password
  22. How do I redirect a user when he is logged in after clicking on a menu
  23. How to target specific user role?
  24. How to redirect user to a specific page based on username?
  25. Redirect after password update
  26. How to redirect user after login to a specific page?
  27. Redirect when accessing /login when logged in
  28. How to redirect after login getting a variable from url (for example with the language)
  29. If User is NOT Logged in and Page ID is not 6 – Redirect to Login
  30. Redirect to Current Page after Login
  31. How to include error message on login
  32. Login redirect problem
  33. redirect Login problems
  34. Page template that redirects user based on role
  35. Redirect user to previous page after signup from custom form
  36. How can I force the user to log in, even if they’re already authenticated?
  37. User is logged in after Stripe payment, then redirected, but is then logged out again
  38. Login Redirect – Multiple Scenarios
  39. WooCommerce – Redirect to a product after login
  40. Usage of the login_redirect filter
  41. Login/Register redirect user with message
  42. Redirect user to original url after login?
  43. Prevent users from going to wordpress profile after login
  44. Redirect each user to specific pages based on their role
  45. Custom form redirect after login
  46. Custom redirect user after login based on metadata
  47. Custom Login Form – Redirect user to login page if not logged in
  48. Redirection on Custom page
  49. Redirect user to specific link after login
  50. Load function with login_redirect
  51. Prevent “/login” to redirect to “/wp-login”
  52. Redirect User to login page
  53. All URLs Redirect to Main Page
  54. How to redirect user after login to the page called by his first name?
  55. redirect doesn’t work while using example code
  56. Why I am not able to direct user to my blog section without login?
  57. Redirect After Login Error
  58. Redirect certain pages if user logged in
  59. Force User Login
  60. wp_login_form redirect
  61. custom login form redirect problem
  62. Login redirect to previous page
  63. Redirect Page ID, based on logged-in User Role
  64. Trying to re-direct users to specific page based on an ACF variable
  65. Disable redirect to homepage after successful Login, Stay on Current Page
  66. Redirect to custom login page if not logged in and redirect to home if logged in user try to login, how?
  67. wp_login_form() redirect same page
  68. How force WordPress redirect to current custom page after login
  69. Hide a Post everywhere except on redirect
  70. Conditional Login Redirect
  71. Keep the old referrer after failed login
  72. Determine user destination on wp-login.php
  73. Redirect user after login to prior page through a wp_login hook
  74. How can force redirected to login for two or more pages to view or access
  75. Redirect after login when WordPress in subdirectory
  76. HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? [closed]
  77. Login redirects to home page and doesn’t log in
  78. WordPress not loggin user and redirecting after custom registration
  79. Redirect user on login using extra field value on login form
  80. Woocommerce login to specific page or referrer
  81. wp-login.php redirect problem
  82. login redirect problem – db charset issue?
  83. How to modify the WordPress comes with redirect
  84. Redirect problem: How to redirect to the original URL after login
  85. Login Form Redirection
  86. Redirect user to login and then to page where they came from
  87. WordPress Login Page redirecting after failed login
  88. Logging back into WordPress after logging out and having issues with ‘loggedout=true’ in redirect URL
  89. login page not working [closed]
  90. Redirect after user changes password
  91. redirect users to the login page
  92. WordPress redirect to splash page once a day for the first week
  93. Accept (once only) policy page on login
  94. login_redirect for Mobile Web
  95. wp_login_form: Redirect to dynamic url according to username
  96. How to disable login and registration pages?
  97. Redirecting by role from a button
  98. Redirecting logged in users to custom URL
  99. login link with auto_redirect
  100. Why is redirect_to parameter not passed to login form in wp-login.php?
Categories redirect Tags conditional-content, login, redirect, user-roles
TinyMCE how to add css when inputing a text
Using AJAX to load div doesn’t always work

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