WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to wordpress, and trying to get my head around the idea of sessions and all. I read in a lot of places that session concept is not used in wordpress. Anyway, I downloaded the my-login-theme plugin. My question is, when a user navigates to some secured area, I want to check if that user is logged in or not. Once I check that, I want to get user details like email, and full name. Is this possible in wordpress?


share|improve this question
up vote 4 down vote accepted

Use the is_user_logged_in() conditional tag (Codex ref) to determine if the current user is logged in.

Use the get_userdata() function (Codex ref) to return user data.

share|improve this answer

You can use is_user_logged_in() to see if the user is logged in. You can use get_userdata() to get the logged in users info.

If you want to restrict access to pages, have you looked at using the plugin Members You can enable shortcodes and template tags to control restricted content to Roles.

share|improve this answer
I'm still learning SE etiquette, so perhaps it's normal; but: why post almost exactly the same answer I did? – Chip Bennett Apr 15 '11 at 17:10
If you look at the timestamps we both posted near the same time. So when I was typing my reply there wasn't any answers. You posted just ahead of me. Normally I would remove my answer but because I offer some other help I have left it up. – Brady Apr 15 '11 at 17:54
Ah, that makes sense, then! – Chip Bennett Apr 15 '11 at 17:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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