Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to redirect to a custom page url if non logged in user clicks on a profile

@kpkreative

Participant

Just incase it helps anyone else, the following code resolved the issue for me:

//Hide for non-logged-in users (public visitors)
add_action( ‘init’, function() {
if ( ! is_user_logged_in() && !bp_is_members_directory() && bp_is_user() ) {
bp_core_redirect( site_url(‘/content-restricted/’) );
} else {
// Do nothing.
}
} );

Skip to toolbar