WordPress.org

Support

Read Privacy

  • I would like to restrict reading of all posts to those who have logged in.

    What’s the best way to do this?
    Am I in plug-in territory?
    Is there a Non-Subscribed Role which I can configure?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sounds like you want a strictly private blog. Presumably, you don’t want to give access to the search engines and other crawlers either. If so, just protect your whole blog with htaccess/htpasswd.

    Thanks pizdin_dim but this is not ideal for me as it will negatively affect the user’s experience.

    Is there any other way?

    i.e. if the user is not logged in, redirect them to the login/register page. I guess some kind of WordPress modRewrite rule equivalent would be ideal.

    Maybe plug-in is the only way.

    Thanks.

    I’m not aware of any plugins for this but you could (in theory) do something like this:

    <?php
    if (!isset($user_level)):
       header('Location: ' . get_settings('siteurl') . '/login.php?redirect_to=' . $_SERVER['REQUEST_URI']);
    endif;
    ?>

    Put it at the top of the “header.php” file in your active theme.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Read Privacy’ is closed to new replies.
Skip to toolbar