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

wp_login_form() passing user ID into URL on redirect?

you can add the user identifier à the redirection URL with this filter

add_filter("login_redirect", function ($redirect_to, $requested_redirect_to, $user) {

    $redirect_to = add_query_arg([
        "user_id" => $user->ID,
    ], $redirect_to);


    return $redirect_to;

}, 10, 3);

Related Posts:

  1. Multi-steps WordPress registration : in 4 steps how to?
  2. Is possible to allow user to login with different role?
  3. WP not logging in at first time
  4. How to allow access based on the user meta flag
  5. How to change default username field after login
  6. WordPress – Security Question at Login from User’s Meta Data
  7. How to authenticate/verify login credentials & check for user meta without logging in?
  8. Redirect Login Based on User Role
  9. If the current user is an administrator or editor
  10. Editor can create any new user except administrator
  11. How do I add a field on the Users profile? For example, country, age etc
  12. How do I display logged-in username IF logged-in?
  13. How to allow an user role to create a new user under a role which lower than his level only?
  14. user_login vs. user_nicename
  15. How to programatically change username (user_login)?
  16. Change the Author Slug from Username to Nickname
  17. Remove Ability for Other Users to View Administrator in User List?
  18. Difference between update_user_meta and update_user_option
  19. Make display name unique
  20. Make WooCommerce pages accessible for logged in users only
  21. Find out if logged in user is not subscriber
  22. WordPress usermeta scaling for thousands of users
  23. How to get WordPress Username in Array format
  24. Display user registration date
  25. Get multiple roles with get_users
  26. get_user_meta() doesn’t include user email?
  27. Confirmation required on email change
  28. How to Merge Two Authors Into One?
  29. Whats the best way to share user data across multiple WordPress websites?
  30. get_current_user_id() returns 0?
  31. How to get userid at wp_logout action hook?
  32. Groups of capabilities: users with multiple roles?
  33. Is there a way to merge two users?
  34. User-edit role setting distinct from wp_capabilities? [closed]
  35. List users by last name in WP_User_Query
  36. What’s the difference between the capability remove_users and delete_users?
  37. How to restrict access to uploaded files?
  38. Automatically delete inactive users after 2 months
  39. How to change user_login with wp-cli?
  40. Delete all subscribers from wp_users and wp_usermeta a few thousand at a time
  41. Email user when password is reset by admin
  42. Replacing the WordPress password validation
  43. Ban a user and end their session
  44. Allowing users to edit only their page and nobody else’s
  45. How can 2 blogs share the same users
  46. alphabetically order role drop-down selection in dashboard
  47. WordPress auto login after registration not working
  48. Change the author slug from nickname to ID
  49. Execute a function when admin changes the user role
  50. How to let contributors to create a new revision(draft) editing their published posts
  51. how to use joomla password format in wordpress?
  52. How to do get_users() with multiple meta_keys
  53. Disallowing Users of a Custom Role from Deleting or Adding Administrators?
  54. What the user_status column?
  55. How to limit users to one comment per post
  56. Different back-end language for different users?
  57. Hide Admin Menu for Specific User ID who has administrator Role
  58. Migrating WordPress users into Disqus
  59. Problem with Hebrew characters in username
  60. Is there an upper limit for users in WP?
  61. How to display the status of users (online – offline) in archive.php
  62. Remove email verification when new user register
  63. How to change user`s avatar?
  64. How to set up User email verification after Signup?
  65. Allow up to 5 Concurrent Login Sessions
  66. How to let user set password on registration
  67. How to hide media uploads by other users in the Media menu?
  68. Show admin bar only for some USERS roles
  69. How to display custom user meta from registration in backend?
  70. Allowing an email as the username?
  71. How to work around “that email address has already been used” error?
  72. Get the name of user who updated post
  73. Disable delete user
  74. Grouping users under parent user
  75. How to get the Gravityform entry ID from current user’s form submission? [closed]
  76. Retrieve all users from wordpress database via REST/JSON API
  77. Is there a way to set a user profile to Draft?
  78. Display edit link if post author is current user
  79. Check if specific username is logged in
  80. Best way to send users password?
  81. Limiting the number of users
  82. How can I get users email (and additional data) from the rest API?
  83. Force display name as full name
  84. Get users with atleast one post
  85. edit profile validation refreshes all field if missing wordpress
  86. How to update user role without logout
  87. How to hide “Filter user list” from “All Users” screen
  88. How to create a template for a custom URI associated with the user
  89. How to order users alphabetically by their last name?
  90. How to check user role without using current_user_can()
  91. How can I run a WP-CLI command as authenticated user?
  92. Why are user address fields required [closed]
  93. How to create a public profile for authors/contributors/users?
  94. Post list based on the user that is logged in
  95. ‘username_exists’ still returns an ID even after deleting record from the database?
  96. Importing users? From another wordpress site
  97. Change user’s display name programmatically
  98. How to discover and delete unused accounts?
  99. Extending WP_User class and using this sub-class during the whole lifecycle
  100. Allow guests to save favourite pages?
Categories users Tags users, wp-login-form
wp_insert_post is not creating revision in database
is_main_query() not working for WP REST API

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