# Filter Posts by Author in the Admin List

> Adds an author dropdown next to the date and category filters, so editors can list one writer's posts.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin, filters, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/filter-posts-by-author/

## Code

```php
add_action( 'restrict_manage_posts', function ( $post_type ) {
    if ( ! post_type_supports( $post_type, 'author' ) || ! current_user_can( 'edit_others_posts' ) ) {
        return;
    }

    wp_dropdown_users( array(
        'name'                    => 'author',
        'show_option_all'         => 'All authors',
        'selected'                => isset( $_GET['author'] ) ? absint( $_GET['author'] ) : 0,
        'capability'              => array( 'edit_posts' ),
        'hide_if_only_one_author' => true,
    ) );
} );
```

## Notes

WordPress already understands the author filter; this snippet only adds the dropdown.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Filter Posts by Author in the Admin List" 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/
