Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Block an additional Page w/ Walled Garden code

  • @mrjarbenne

    Participant

    I’m using this code to make my buddypress site private to logged in users only, but keeping the blog and non-BP pages available to visitors.

    function sh_walled_garden()
    {
    if( ! bp_is_blog_page() && ! is_user_logged_in() )
    bp_core_redirect( $bp->root_domain );
    }
    add_action( 'wp_loaded', 'sh_walled_garden' );

    I’m now trying to block access to one specific page. I thought I could do it with the same code like this

    if( ! is_page( 697 ) && ! is_user_logged_in() )
    bp_core_redirect( $bp->root_domain );

    but I think I’ve got a few too many exclamation marks creating redirects that will never complete.

    Any thoughts on how I can block a specific page from view?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Block an additional Page w/ Walled Garden code’ is closed to new replies.
Skip to toolbar