WordPress: Thêm bộ lọc tác giả vào danh sách bài viết của quản trị viên

Để thêm bộ lọc tác giả vào trang danh sách bài viết có sẵn trong WordPress, chỉ cần thêm đoạn mã sau vào tệp functions.php:
Lưu ý: Tôi đã để lại bình luận về lệnh điều kiện liên quan đến các loại bài viết, nó có thể hữu ích 😊
function restrict_manage_authors() {
/*if (isset($_GET['post_type']) && post_type_exists($_GET['post_type']) && in_array(strtolower($_GET['post_type']), array('your_custom_post_types', 'here'))) {
*/wp_dropdown_users(array(
'show_option_all'	=> 'Show all Authors',
'show_option_none'	=> false,
'name'			=> 'author',
'selected'		=> !empty($_GET['author']) ? $_GET['author'] : 0,
'include_selected'	=> false
));
/*}*/
}
add_action('restrict_manage_posts', 'restrict_manage_authors');