X

Check if user is logged in

Using this PHP code in your wordpress theme will let you display alternate content to users that are logged in. You could use this to display a custom message to logged in users eg: register or welcome message for members.



Code Snippet:


<?
if (is_user_logged_in()) {
/* yes user is logged in */
}else{
/* no user is not logged in */
}
?>

Comments  Leave a Reply

  1. Tweets that mention Wordpress Check if user is logged in – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com November 19, 2010 at 8:34 pm

    […] This post was mentioned on Twitter by Constance, Hilda and Natella, WPSNIPP. WPSNIPP said: #wordpress Check if user is logged in http://bit.ly/cVKBto #blog please RT 🙂 […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!