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

Using wp_login vs login_redirect to redirect based on user-meta

Are you sure $user->user_profile_setup is the correct way to reference the meta info?

# does 'user_profile_setup' show up under wp_get_current_user()?
print_r(wp_get_current_user());

I think you mean to do:

function first_time_login( $redirect_to, $user){
  if( get_user_meta($user->ID, 'user_profile_setup', true) == 'true' ){ //edited line
    return $redirect_to;
  }
  else{
    return "/account-setup?redirect_to='". $redirect_to . "'";
  }
}

Assuming that

$current_user = wp_get_current_user();
print_r(get_user_meta($current_user->ID));

Outputs

Array
(
  ...
  [user_profile_setup] => Array
    (
      [0] => true
    )
  ...
)

Related Posts:

  1. Redirecting users based on custom user meta
  2. How $_GET[‘updated’] variable is passed when updating a user?
  3. wp_redirect not working after update_user_meta
  4. how to get list of all users and their metadata
  5. add_user_meta() vs update_user_meta()
  6. How to make a custom column on the Users admin screen sortable?
  7. wp_update_user doesn’t update and update_user_meta does
  8. Get basic Image Uploader on User Profile Page
  9. Return all users with a specific meta key
  10. Capabilities Vs User Meta
  11. Problem storing arrays with update_user_meta
  12. wp_get_current_user always returns 0
  13. get_users is expecting unserialized meta_value
  14. remove user_meta data from database for all users
  15. How to get last login Access Date and time
  16. How to get user metadata for social media url?
  17. Admin user edit – Grab newly submitted user meta immediately after update/submit
  18. how to get specific fields from get_user_meta()
  19. Validating a new user registration field
  20. Action wp_login_failed not working if only one field is filled out
  21. Check if WP_User_Query ‘include’ is empty
  22. User meta to post
  23. wp_get_current_user in custom file returns 0
  24. Is there a limit to the length/size of serialized data that can be stored as user meta?
  25. Add profile field (usermeta) to Add New User
  26. very last action before during user registration before he is redirected to homepage
  27. Redirect user after login/registration globally
  28. Customizing WP tables or adding new ones?
  29. How to Make admin Sidebar Menu always be Collapse by code
  30. Are the default entries for a user in wp_usermeta documented?
  31. get_users / WP_User_Query returns empty when logged out
  32. update_user_meta adding new rows in db for same key
  33. How to query users by meta value, even when meta key doesn’t exist?
  34. What is the meta-box-order_post_hash used for?
  35. Add a member number to new user
  36. Allow role to edit users at lower level with only specific metadata
  37. Hook or action to save profile fields at specific time
  38. User meta conventions / name registry, for social media links
  39. Get user’s ID on logout
  40. How to get the user description with get_users?
  41. get current user not working
  42. Sanitize textarea instead of input
  43. Multiple User-Meta Values in One User-Meta Key
  44. Getting $user_id for the_author_meta outside the loop in multisite
  45. Gravity Custom Merge Tags [closed]
  46. No first_name or user_firstname property in WP_User object
  47. How to auto login after registration? [duplicate]
  48. How to insert new element to existing array in usermeta?
  49. Possible bug: update_user_meta is updating two unique meta entries
  50. Update user meta through a front end form
  51. What is the difference between get_the_author_meta() and get_user_meta()?
  52. Restricting frontend acess based on user role otherwise redirect to login form
  53. How to display current_user bio
  54. Is a user_meta research case-sensitive or not
  55. Store user’s registration date as meta
  56. Can I prevent “wp_user_level” from getting added to wp_usermeta on registration?
  57. Get the Google+ and Twitter links – WordPress SEO plugin
  58. How to tell whether a user meta value has increased or decreased [closed]
  59. Showing all users who match 2 meta fields with current user
  60. Adding current user’s ID to the end of PDF hyperlinks in post content
  61. update_user_meta() not working
  62. How to display user’s avatar on their profile page?
  63. Send mail to user only once when specific check box is selected and updated from profile meta updated by admin
  64. WP_user_query throws a 404 error
  65. Incrementally add or substract from usermeta field
  66. add custom field in user register form
  67. Is it possible to read a result if wp_update_user or update_user_meta fails?
  68. set a user-meta key as avatar
  69. Prevent update of custom user profile meta field on the front end after 1st entry
  70. User last login and user last visit problem
  71. Why get_users() not working on the admin backend?
  72. Can I set user meta for theoretical user 0?
  73. Is there a way to append meta data without creating a race condition?
  74. strange issue with user_meta + json_encode/decode
  75. Inserting and finding multiple values in user-meta fields
  76. Update user meta on logout
  77. update_user_meta after wordpress in action hooks
  78. Adding user data to an existing user_id
  79. I want to update my user meta table
  80. Problem to wp_hash
  81. trying to determine if meta value exists for user and if not auto submit gravity form to redirect
  82. Subscribers Group User meta delete
  83. action user_new_form param is a string
  84. Customize Avatar using user meta
  85. get_user_meta returning old data
  86. Why does the usermeta table contain html entities?
  87. get_user_meta returning empty when it’s NOT empty
  88. How can I programmatically show a specific (template) page, like author.php?
  89. WP_User_Query not returning users with meta – what am I missing?
  90. Multiple meta values for one meta key
  91. When is a user’s meta data table loaded?
  92. Display and Update User Custom Meta via user-edit.php
  93. Redirect wp-login
  94. Multiple Email Addresses, One User
  95. Redirect outside WP after login
  96. WordPress REST API and User meta data
  97. How do I add a dropdown list of numbers 1 – 1000 as an extra profile field?
  98. force login and redirect to custom login page
  99. Get user meta for only the keys with a certain prefix
  100. Serializing User Role for update_user_meta
Categories user-meta Tags user-meta, wp-login-form, wp-redirect
network admin pages not linked to correctly
How to get specific table by current user login

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