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

Correct method of redirecting user login

I am not sure there is a canonical answer to this question but there is a login_redirect hook which, from the Codex, is explicitly “to change the location redirected to after logging in.”

But I offer that with caution.

I don’t know what the s2Member plugin is doing or why it is doing whatever it is on the wp_signon hook, per your description (I haven’t looked). That might be the only way to do whatever the plugin needs to do.

And of course, that will interfere with other plugins. Sometimes plugins just conflict. That is probably unavoidable.

I can imagine circumstances where you would want to kill everything– access/security related circumstances– but as I said without knowing exactly what the plugin is doing I can’t comment on whether (I think) it is “doing it right” or not.

And looking into the wp_login hook, I notice that it is an action. An action is the kind of hook to use to do this sort of thing. There would be more of a case for “doing it wrong” if the hook were a filter, which should reasonably be expected to return data. Actions just “do stuff”. They are a way to insert, reorganize, whatever.

Related Posts:

  1. add filter login_redirect does not contain original requested redirect
  2. How to redirect non-logged in users to login with post_password_required()
  3. How to redirect a unique link based on login status
  4. Hook into ‘when user logs in’ [persistent login]
  5. add_action(), add_filter() before or after function
  6. Trouble understanding apply_filters()
  7. What is the very earliest action hook you can call?
  8. wp_headers vs send_headers. When to use each?
  9. How many filter/action hooks are healthy?
  10. Earliest hook to reliably get $post/$posts
  11. Remove Editor From Homepage
  12. What does (10, 2) mean when used with add_filter
  13. Valid characters for actions, hooks and filters
  14. Advanced Custom Fields and Yoast SEO keyword analysis [closed]
  15. How to check if a hook is hooked or not?
  16. Editing ‘Password Reset’ E-mail
  17. Is it possible to use object in add_action?
  18. Store source permalink on XMLRPC calls
  19. How to make post and comment count unclickable with dashboard_glance_items hook
  20. Change “You are now logged out” text
  21. Hook into admin post list page
  22. Action wp_login_failed not working if only one field is filled out
  23. Anyway to edit the titlebar of WordPress Widgets in the Admin area?
  24. How do I know if author field was changed on post save?
  25. Using hooks to place content in theme dynamically
  26. About Hooks and Filters
  27. PHP5, Inheritance, Singleton – action & filter hook limitations
  28. Should I use add_action(‘publish_post or add_filter(‘publish_post?
  29. Please explain me what the do_action does
  30. Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
  31. add_action uses ‘echo’ add_filter uses ‘return’, why?
  32. Removing labels and tag on WordPress’s default login form
  33. changing variable through filters or action hooks
  34. Too many actions/filters!
  35. Apply a filter only once
  36. How to get list of all hooks of current theme / plugin?
  37. Making a class available via actions filters
  38. How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
  39. How to get current action?
  40. Customize user account activation message
  41. Conditionally call add_action depending on post_type?
  42. How do we check if the user is logging in or registering?
  43. how to change appearence of the content of default post list columns?
  44. Anonymous function is executed twice in wp_head while added from the_posts filter?
  45. Explanation for remove_filter used in the below code [closed]
  46. How to change the blog title with add_filter? details below
  47. How To Get User Data in Callback Function for pre_user_nicename?
  48. What’s the best way to split admin-only functionality in the theme’s functions.php file?
  49. Filter list by a unique meta value dilemma
  50. return values from hooks do_action and apply_filters, which is better
  51. How to get all the predefined do_action() calls from an active theme
  52. Is it possible to track down Actions and Filters?
  53. When to use actions and when to use filters
  54. Return a custom value in a function added to an action hook
  55. Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
  56. Same Conditionals Not Working on Two Different Hooks
  57. How to call a function or method that is Namespaced using another plugin
  58. How to change currency programmatically on creating order action?
  59. get_header and hook avoid normal call
  60. Removing an action, or dequeueing style – Both not working
  61. Can the wp_filter object hold multiple values with the same key
  62. Change username before login
  63. How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
  64. apply_filters/do_action tag characters limit
  65. Custom Login Errors and variables I can use
  66. Replace a word with a word in the URL string
  67. Is there a filter called ‘network_admin_init’?
  68. How to add ‘total’ value to custom column title on the posts list page
  69. Filter taxonomy admin pagination
  70. When to use add_action when registering/enqueuing scripts
  71. Insert term when page is published – avoid duplicates after edits
  72. Are there actions or filters I can use for Ajax calls?
  73. Capture post content before page renders
  74. Shortcodes — Using add_action, add_filter in the shortcode
  75. How to remove action with slashes and arrows?
  76. Can the wordpress color palettes by changed through Javascript?
  77. How do I use remove_action on an add_action that uses an array?
  78. How to properly modify WP Vary or any existing headers?
  79. Changing WordPress core without hacking core
  80. How to pass variables to custom filter from multiple functions
  81. Building a request processor for multi-page forms, etc using $_GET requests
  82. Comment search plugin
  83. How to customize the “Insert/edit link” popup box?
  84. Proper after_setup_theme and wp_head cleanup
  85. How to get a single hook from wp_head()?
  86. How can I output all apply_filters and do_action?
  87. How to allow code block in wordpress comments
  88. Add a filter inside an action init
  89. Filters on Login Page
  90. remove_action: how to access to a method in an child class?
  91. How can I change the email that is inside the default email texts of wordpress?
  92. Is it possible to apply_filter on a wp_ajax_ action?
  93. Filter for when the post is updated
  94. Add a filter to an action [closed]
  95. How do I hook my function to run only after submitting login form
  96. Change login CSS
  97. How can I specify the post status of an untrashed post?
  98. Filter wp_redirect() to stop redirect under certain condition
  99. Filter get_page_by_path()
  100. why require – does not load filter
Categories filters Tags actions, filters, login, s2member, wp-redirect
Prevent WordPress from interpreting a subfolder?
Highlight wp_nav_menu when category is selected

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