0

I've already read the WordPress documentation for those functions, but is still unclear for me where is the difference between:

get_userdata() vs get_currentuserinfo()

As far as I know the get_userdata() require a parameter such as user_id or something else that's all, and get_currentuserinfo() does not.

Am I wrong?

1
  • Please revisit all your old posts and accept all answers that solved your issue. You can accept the best answer by clicking on the check mark on the left of the answer just below the up and downvote arrow. That checkmark will go green which will show that that answer is the one which solved the issue Jul 8 '16 at 7:35
1

get_userdata() returns you the data of a specific user (by id), while get_currentuserinfo() returns data about the current logged in user.

For example, you could use get_currentuserinfo() to welcome a user (e.g. "Welcome back John"), if he's signed in.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.