• I have built a wordpress site for a friend.
    He wants to have the site be open to everyone but have the blog page locked down so that only registered user can view that page.

    i have attempted to accomplish this buy using a plug in called theme-my-login.
    I also have a snippet of code that looks like this in the header.

    <?php
    if (!is_user_logged_in() && $_GET["page_id"]!=7)
    {header('Location: '.wp_login_url());}
     ?>

    right now it locks down the whole site.

    i was given this advice but am not sure how to accomplish it.

    The snippet uses a redirect header to force the browser to the url of the login page if the user isn’t already authenticated. If that staic content is being served by wordpress, you’ll need to modify the snippet so that it will only redirect if the destination url is the same as the blog url (remembering to account for a possible query string on the end). Also a problem I had when I first wrote that was it would redirect infinitely because I didn’t make an exception for the login url with possible query string.

    the blog address is ?page_id=15

    any help would be greatly appreciated.

  • The topic ‘multiple log in functionality’ is closed to new replies.