How to Exclude a Group From the Loop in BuddyPress
However, if you need the group to be visible in the directory but not in a particular widget, then you’ll have to use a little hack for now.
One example would be if you’re using a group as a shell for a “global forum” and you want to exclude that group from a widget that displays popular groups. BuddyPress documentation for custom group loops doesn’t include a parameter for excluding particular groups, so here’s how you can do it:
<?php while ( bp_groups() ) : bp_the_group(); if(bp_get_group_name() != 'My Group' ) : ?>
Replace ‘My Group’ with the group name that you want to exclude. Also, don’t forget to add an endif; right before the endwhile;
<?php endif; ?>