Exclude groups from get_total_group_count
- 
		Hello all! I want some groups with specific slug (so the condition is wp_bp_groups.status not in (‘xxx’, ‘yyy’)) to not be included at total groups count. I found that the hook is bp_get_total_group_count but how I can filter it? Do I have to change the query to database? I have write this to functions.php and it works: function filter_bp_get_total_group_count() { global $wpdb; $hidden_sql = "WHERE slug not in ('health', 'social', 'cultury')"; $bp = buddypress(); return $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" ); }; // add the filter add_filter( 'bp_get_total_group_count', 'filter_bp_get_total_group_count', 10, 1 );But this is the way?? Isn’t there something better?? Thank you! Regards, Andreas 
Viewing 9 replies - 1 through 9 (of 9 total)
	
Viewing 9 replies - 1 through 9 (of 9 total)
	
- The topic ‘Exclude groups from get_total_group_count’ is closed to new replies.