0

Posted by Michael Alfaro on January 25, 2012

How to restrict viewing wordpress pages to logged in users

If you’re looking to make particular pages visible to only people that are logged in and letting them know that they need to log in, I found this article that help you achieve that through the page templates:

http://www.wprecipes.com/how-to-restrict-page-view-to-authenticated-users

Here’s the sample code:

if (is_user_logged_in()) {
// You page code goes here
} else {
echo "You must be logged in to view this page.";
}

Enjoy!!!

Topics: , ,

Add a Comment