In this post, I will share step-by-step instructions on how you can easily filter posts by authors in WordPress Admin Panel.
The default admin panel lets you filter posts by the below functions.
- Month
- Category
- Post Status
The Author filter is not included by default. You can easily get posts for a particular author with the author filter functionality.
Let’s start to understand the author filter.
Please copy the below code and paste it into your child theme’s functions.php file.
/** * This section makes posts in the admin filterable by the author. */ add_action('restrict_manage_posts', 'ditt_filter_by_author'); function ditt_filter_by_author() { $params = array( 'name' => 'author', 'role__in' => array('author','editor','administrator') ); if ( isset($_GET['user']) ) { $params['selected'] = $_GET['user']; } wp_dropdown_users( $params ); }
For the output, Please check the below video.
Adding an Author filter in WordPress is now easy.
If you have got any doubts then feel free to ask in the comments.