This topic has 1 reply, 2 voices, and was last updated 7 years by Laura.

  • Author
  • #202266
     hamsar
    Participant

    Hi,

    I m using this snippet and its blocking the post to be viewed by non logged users. But I want to allow blog post to be viewed by non logged users. How can i make it happen. Thanks

    /* Restrict guests only to those pages.*/
    function sq7R_kleo_restrictions_guest_restrict() {
    $allowedpages= array(‘register’,’activate’,’Home’,’blog’,’reasons-to-join’,’privacy-policy’,’about-us’,’terms-of-service’,’contact’);
    if( !is_user_logged_in() && !is_page($allowedpages)) {
    wp_redirect(site_url( ‘/register’) );
    }
    }
    add_action(‘template_redirect’, ‘sq7R_kleo_restrictions_guest_restrict’);

    #202358
     Laura
    Moderator
    Not marked as solution
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?