WordPress.org

Ready to get started?Download WordPress

Forums

Read Privacy (4 posts)

  1. JoeCleave
    Member
    Posted 7 years ago #

    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.

  2. pizdin_dim
    Member
    Posted 7 years ago #

    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.

  3. JoeCleave
    Member
    Posted 7 years ago #

    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.

  4. pizdin_dim
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic