I am using buddypress on my site and i want to hide "All Groups" tab and show only "My Groups" tab to the loggedin user.
Asked
Active
Viewed 397 times
2 Answers
0
remove "All Groups" Tab in to the loggedin user
Add below function in function.php file
if ( is_user_logged_in() )
{
function hide_all_groups_tab() {
?>
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
jQuery("#groups-all").removeClass('selected');
jQuery('.item-list-tabs ul li:first').css('display', 'none');
jQuery("#groups-personal").addClass('selected');
} );
</script>
<?php
}
add_action( 'wp_footer', 'hide_all_groups_tab' );
}

Shital Marakana
- 2,817
- 1
- 9
- 12
-1
I had to change .item-list-tabs
to .groups-nav-tabs
but it works like a charm.

Sabito stands with Ukraine
- 4,271
- 8
- 34
- 56