How to hiding / redirect users page from non logged in users ?
Follow the below suggestions to protect your WordPress BuddyPress member-only pages. Just include this simple snippet into your WordPress theme’s ‘functions.php’. That’s it..
This sample script will redirect the unknown visitor who is trying to visit the protected BuddyPress pages.
A non-logged-in user trying to access private content will be redirected to your website’s 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( 'https://vvcares.com/?buddypressBlogPostRedirect' ) ); exit(); } } add_action( 'template_redirect', 'bp_logged_out_page_template_redirect' );