Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Hide everything from BuddyPress to non-logged in users

@benofinil

Participant

I found this code and it works perfectly !
Hope it will help some of you…

function kleo_page_template_redirect()
{
//if not logged in and on a bp page except registration or activation
if( ! is_user_logged_in() && ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) {
wp_redirect( home_url( ‘/login/’ ) );
exit();
}
}
add_action( ‘template_redirect’, ‘kleo_page_template_redirect’ );

Skip to toolbar