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

add filter login_redirect does not contain original requested redirect

You can use login_redirect filter. See here http://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect

I think this is what you are looking for.

This will normally redirect all logins. To be able to redirect only when you want, you can use a query string parameter in the URL. Check for the parameter, if it exists redirect.

Try to add this in your template functions.php file:

add_action( 'login_form' , 'glue_login_redirect' );
function glue_login_redirect() {
    global $redirect_to;
    if (!isset($_GET['redirect_to'])) {
        $redirect_to = 'YOURURLHERE';
    }
    else{
        $redirect_to = $_GET['redirect_to'];
    }
}

Related Posts:

  1. Trouble understanding apply_filters()
  2. How many filter/action hooks are healthy?
  3. Earliest hook to reliably get $post/$posts
  4. What does (10, 2) mean when used with add_filter
  5. Valid characters for actions, hooks and filters
  6. How to check if a hook is hooked or not?
  7. How to make post and comment count unclickable with dashboard_glance_items hook
  8. Hook into admin post list page
  9. Anyway to edit the titlebar of WordPress Widgets in the Admin area?
  10. About Hooks and Filters
  11. Should I use add_action(‘publish_post or add_filter(‘publish_post?
  12. Please explain me what the do_action does
  13. Removing labels and tag on WordPress’s default login form
  14. Too many actions/filters!
  15. How to get list of all hooks of current theme / plugin?
  16. How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
  17. Customize user account activation message
  18. Conditionally call add_action depending on post_type?
  19. Is it possible to track down Actions and Filters?
  20. When to use actions and when to use filters
  21. Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
  22. Same Conditionals Not Working on Two Different Hooks
  23. How to call a function or method that is Namespaced using another plugin
  24. get_header and hook avoid normal call
  25. Can the wp_filter object hold multiple values with the same key
  26. Change username before login
  27. How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
  28. apply_filters/do_action tag characters limit
  29. Filter taxonomy admin pagination
  30. Insert term when page is published – avoid duplicates after edits
  31. Capture post content before page renders
  32. Correct method of redirecting user login
  33. How to remove action with slashes and arrows?
  34. Changing WordPress core without hacking core
  35. Comment search plugin
  36. How can I output all apply_filters and do_action?
  37. How do I hook my function to run only after submitting login form
  38. Remove actions/filters that are set with create_function()
  39. Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
  40. Remove tags without a specific meta key from “choose from the most used tags”
  41. How to access page variable inside action hook
  42. What is the action hook to use if you want to capture the new password during password change?
  43. Use has_filter on comment_post
  44. How can I edit comment meta value before it is saved?
  45. Action hook to control access to certain parts of my site
  46. Replace Data In Post & Update Meta Field Post Is Saved
  47. style_loader_tag not changing stylesheet to preload
  48. How to redirect a unique link based on login status
  49. Hook to change the site URL
  50. Hook to add content after date in post?
  51. Hook inside a hook
  52. Hook into ‘when user logs in’ [persistent login]
  53. Can you call a filter hook by “add_action”?
  54. Change password reqts with NO plugin without breaking resetpass link?
  55. Passing a parameter to filter and action functions
  56. Difference Between Filter and Action Hooks?
  57. How to know what functions are hooked to an action/filter?
  58. Get a list of all registered actions
  59. WordPress hooks/filters insert before content or after title
  60. Is there a hook that runs after a user logs in?
  61. How can I edit post data before it is saved?
  62. add_action(), add_filter() before or after function
  63. How do filters and hooks really work in PHP
  64. What is the very earliest action hook you can call?
  65. wp_headers vs send_headers. When to use each?
  66. Is there any action filter/hook for validating a custom field before publishing the post?
  67. Filter specific shortcode output?
  68. How to pass/get data to/from the WooCommerce data-product_variations object?
  69. Remove Editor From Homepage
  70. Where to hook into post content?
  71. Clarification on filters and hooks
  72. How to only hook on Single.php after content?
  73. Advanced Custom Fields and Yoast SEO keyword analysis [closed]
  74. How to hook into unregistering a widget instance?
  75. Implementing advanced add_* function wrappers
  76. Editing ‘Password Reset’ E-mail
  77. Is it possible to use object in add_action?
  78. Passing Additional Parameters to add_filter Callable
  79. What hook do I use to edit the post statuses option in admin?
  80. Filter hook before create order WooCommerce
  81. Modify WordPress Rest Api Request/Response
  82. How to add some custom HTML into wordpress admin bar?
  83. How do you use the plugin boilerplate loader class to hook actions and filters?
  84. Custom theme hooks / filters – passing arguments
  85. wp_mail – Remove sitename from email subject
  86. Run javascript code after wp_login hook?
  87. How do I Make a Theme “plugin-ready”?
  88. Store source permalink on XMLRPC calls
  89. How to disable all WordPress emails modularly and programatically?
  90. How to hook wp_list_pages?
  91. apply_filters() slices away needed arguments
  92. WP Rest API – Upload media without saving attachment post
  93. How can I tell if I’m on a login page? [duplicate]
  94. How to use the_excerpt in a filter hook?
  95. Change the footer text on the login page
  96. How to add attribute to output with wp_video_shortcode add_filter
  97. How to change Woocommerce breadcrumbs content?
  98. Change “You are now logged out” text
  99. How do I know if author field was changed on post save?
  100. How to limit the pages displayed for choosing parent page on page attribute’s menu?
Categories filters Tags actions, filters, hooks, login
Attach parent category template to all subcategories
Loop posts only excluding first post

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