Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • thanks man, yes, need to be add exit. And what's wrong with my first problem, why get_current_user_id() got 0? Commented Jul 12, 2013 at 8:13
  • I updated my answer Commented Jul 12, 2013 at 8:17
  • it works man, but I wonder, why use get_current_user_id() not working, because I have been logon, so it should be get the current user id ? Thanks Commented Jul 12, 2013 at 8:28
  • I don't know why get_current_user_id() doesn't work, maybe someone else will help us understand that point. Commented Jul 12, 2013 at 9:19
  • Shouldn't have to call get_current_user_id, the hook passes the $WP_User object: do_action( 'wp_login', string $user_login, WP_User $user ) Commented Feb 9, 2023 at 8:55