# BuddyPress: Hide Administrators' Activity From the Stream

> Keeps activity created by administrators (such as testing posts and profile edits) out of the public activity streams.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: buddypress, activity, admins
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/buddypress-hide-admin-activity/

## Code

```php
if ( ! function_exists( 'buddypress' ) ) {
    return;
}

add_filter( 'bp_after_has_activities_parse_args', function ( $args ) {
    if ( bp_is_user() && bp_is_my_profile() ) {
        return $args;
    }

    $admins = get_transient( 'wpide_bp_admin_ids' );

    if ( false === $admins ) {
        $admins = array_map( 'intval', get_users( array( 'role' => 'administrator', 'fields' => 'ID', 'number' => 200 ) ) );
        set_transient( 'wpide_bp_admin_ids', $admins, HOUR_IN_SECONDS );
    }

    if ( $admins ) {
        $query   = empty( $args['filter_query'] ) ? array() : (array) $args['filter_query'];
        $query[] = array( 'column' => 'user_id', 'value' => $admins, 'compare' => 'NOT IN' );
        $args['filter_query'] = $query;
    }

    return $args;
} );

add_action( 'set_user_role', function () {
    delete_transient( 'wpide_bp_admin_ids' );
} );
```

## Notes

Administrators still see everything on their own profile. The ID list is cached for an hour.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "BuddyPress: Hide Administrators' Activity From the Stream" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
