How to hiding / redirect users page from non logged in users ?

Wordpress buddypress non member

Here the simple step to protect your WordPress BuddyPress member only pages. Add this simple snippet into your theme’s ‘functions.php‘ file. That’s it..

The below snippet sample will redirect the visitor if the visitor is not logged in & trying to visit the sensitive BuddyPress pages.

Will redirect non-logged-in users trying to access private content to your front page or home page

//Hide for non-logged-in users (public visitors)
function bp_logged_out_page_template_redirect() { if( ! is_user_logged_in() && is_page( 'members' )|| is_page( 'activity' ) || bp_is_user()  ) { wp_redirect( home_url( '' ) ); exit(); } } add_action( 'template_redirect', 'bp_logged_out_page_template_redirect' );
5 thoughts on “How to redirect users, WordPress BuddyPress hide page from non-members, Non-Loggedin users..”
  1. Nice post. I was checking constantly this blog and I am impressed!
    Extremely helpful info specifically the last part 🙂 I care for
    such info a lot. I was seeking this certain information for a
    long time. Thank you and good luck.

  2. I feel this is one of the so much vital info
    for me. And i’m glad studying your article. But should observation on few normal issues, The web site
    taste is great, the articles is truly nice :
    D. Excellent job, cheers

  3. 강ë‚Ļ홀ëĪ 홀ëĪ펍 강ë‚Ļ홀ëĪ바 텍ė‚ŽėŠĪ홀ëĪ says:

    I am in fact delighted to glance at this blog posts which contains plenty of useful data, thanks for providing
    these data.

  4. Hey There. I found your blog using msn. This
    is a very well written article. I will make sure
    to bookmark it and return to read more of your useful
    info. Thanks for the post. I will definitely return.

Leave a Reply

Your email address will not be published.