Got a private site, with 4 public pages. The public pages include: Login, lost password, register and preview. The preview page shows content set to anyone only. I need the preview page to be hidden from logged in users only. Is there a way to do this?


1 Answer 1


You can create a page template to check if user is loggedin. And if it does then redirect user to website homepage (configurable), otherwise show page content.

This is the simple condition you can use to check if user is loggedin.

    if ( is_user_logged_in() ) {

        wp_redirect( home_url( '/' ) );

    } else {


  • That's great. I am glad I could help. If it helped you solve your problem, don't forget to accept the answer. :)
    – Robert hue
    Commented Oct 19, 2014 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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