BuddyPress: Hide Noisy Activity Types From the Stream
Removes routine entries such as "became a registered member", "changed their profile picture" and new friendships from the activity streams.
Opens WPIDE on
Code
if ( ! function_exists( 'buddypress' ) ) {
return;
}
// Activity types to hide.
$wpide_bp_hidden_types = array( 'new_member', 'new_avatar', 'updated_profile', 'friendship_created' );
add_filter( 'bp_after_has_activities_parse_args', function ( $args ) use ( $wpide_bp_hidden_types ) {
$query = empty( $args['filter_query'] ) ? array() : (array) $args['filter_query'];
$query[] = array( 'column' => 'type', 'value' => $wpide_bp_hidden_types, 'compare' => 'NOT IN' );
$args['filter_query'] = $query;
return $args;
} );
Notes
The entries are hidden, not deleted, so removing a type from the list brings them back.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.