# Hide Staff Replies in the Recent Comments Widget

> Leaves comments written by authors, editors and administrators out of the Recent Comments widget, so it highlights what readers are saying.

- Type: PHP
- Runs: Run everywhere
- Category: [Widgets](https://wpide.com/library/category/widgets/)
- Tags: widgets, comments, community
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/recent-comments-widget-hide-staff/

## Code

```php
add_filter( 'widget_comments_args', function ( $args ) {
    $staff = get_users( array(
        'capability' => 'edit_posts',
        'fields'     => 'ID',
        'number'     => 200,
    ) );

    if ( $staff ) {
        $args['author__not_in'] = array_map( 'intval', $staff );
    }

    return $args;
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Staff Replies in the Recent Comments Widget" 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/
