What if you have too many blog posts? How do you manage them in the WordPress admin page.

In this article, I will show you how to create more custom filters in the WordPress admin page. More specifically the filter by author and by taxonomy.
Filter articles by author
Here is the resulting image after you follow your instructions:

This filter supports not only Posts, but also Pages and custom post types. Please put the code below in the file functions.php of the theme or child theme.
function hk_filter_by_the_author() {
$params = array(
'name' => 'author',
'show_option_all' => 'Tất cả tác giả'
);
if ( isset($_GET['user']) )
$params['selected'] = $_GET['user'];
wp_dropdown_users( $params );
}
add_action('restrict_manage_posts', 'hk_filter_by_the_author');
<div>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span>
</div>
That’s it, you can now filter posts by specific author in the WordPress admin page.
Filter articles by taxonomy
As you also know, WordPress already has a default filter by the category of Posts. However, your site has other custom post types, and you want to create a taxonomy filter for those post types.
Here, I will show you how to do this. But first, here’s my actual resulting image:

Please put the code below in the functions.php file of your theme or child theme.
function hk_posts_taxonomy_filter() {
global $typenow;
if ($typenow == 'du-an') { // post type slug
$taxonomy_names = array('loai-hinh-du-an', 'chu-dau-tu'); // taxonomy slug
foreach ($taxonomy_names as $single_taxonomy) {
$current_taxonomy = isset( $_GET[$single_taxonomy] ) ? $_GET[$single_taxonomy] : '';
$taxonomy_object = get_taxonomy( $single_taxonomy );
$taxonomy_name = strtolower( $taxonomy_object->labels->name );
$taxonomy_terms = get_terms( $single_taxonomy );
if (count($taxonomy_terms) > 0) {
echo "<select name="$single_taxonomy" id="$single_taxonomy" class="postform">";
echo "<option value="">Tất cả $taxonomy_name</option>";
foreach ($taxonomy_terms as $single_term) {
echo '<option value=". $single_term->slug, $current_taxonomy == $single_term->slug ? " selected :>' . $single_term->name .' (' . $single_term->count .')</option>';
}
echo "</select>";
}
}
}
}
add_action( 'restrict_manage_posts', 'hk_posts_taxonomy_filter' );
<div>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span><span>19</span><span>20</span><span>21</span>
</div>
Unlike the author part, in this part, please pay attention a little bit.
First, on the 3rd line, you will see the $typenow == 'du-an' paragraph . This is my post type slug. Please replace it with your own. Also if you want more than one post type in this case, change the code in the if statement in the 3rd line to $typenow array('post-type-1', 'post-type-2') .
Second, on the 4th line, you will see the $taxonomy_names = array('loai-hinh-du-an', 'chu-dau-tu'); paragraph . This is my taxonomy slug, please replace it with yours.
So it’s done. Enjoy the results you’ve made.
Epilogue
This is an extremely useful trick to help you save time, and manage your posts more effectively. If you found this article helpful, please comment and share this article.
In addition, you can follow the WordPress Tips section and follow Facebook for more new knowledge.

