Hello,
I have added your snippet and works.
function buddydev_hide_members_directory_for_all_except_admin() {
if ( bp_is_members_directory() && ! is_super_admin() ) {
bp_do_404();
load_template( get_404_template() );
exit( 0 );
}
}add_action( ‘bp_template_redirect’, ‘buddydev_hide_members_directory_for_all_except_admin’ );
Only, I’d like to send not admin to another page not 404.
How could I do?
Many thanks,
Giuseppe
Hi Giuseppe,
Thank you for the question.Please remove the above code and use this instead
// Redirect from members directory. function buddydev_hide_members_directory_for_all_except_admin() { if ( bp_is_members_directory() && ! is_super_admin() ) { $url_to_redirect_to = "http://example.com/some-page"; bp_core_redirect( $url_to_redirect_to ); } } add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_for_all_except_admin' );
Please make sure to change your own url.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Redirect BuddyPress Members from everyone except Site admin to search page’ is closed to new replies.
This topic is: resolved