How to filter posts by taxonomies in the WordPress admin area
Last Updated: September 14, 2020 in Guides
When we go to All Posts in the WordPress dashboard, we see a list of posts in a table. WordPress has some controls to let us filter the posts by month or categories. That is enough for posts. But for custom post types that have custom taxonomies, we don't have any way to show only posts of a specific term. This post will show you how to do that.
Assume we have a custom post type "Computers". Each computer can have "Country" of origin and "Brand", which are custom taxonomies. We need a way to show only computers from US (a specific term of "Country") and/or computers from Asus (a specific term of "Brand"). This screenshow shows the result we want to achieve:
How to filter posts by taxonomies
To do that, you need to install a plugin called Admin Taxonomy Filter. Go to Plugins → Add New and search for Admin Taxonomy Filter. Then click Install button to install it. And then click Activate to activate the plugin.
The plugin adds a new settings page under Settings → Taxonomy Filter. Go to that page and you will see a list of available taxonomies that you can filter by:
The taxonomies are listed by post types. Please note that a taxonomy can be available for multiple post types. You might want to filter a post type by that taxonomy but don't want to do so for another post type. So, just select taxonomies for the post types you want to filter here. Click Save Changes when you're done.
After that, go to Computers → All Computers (if you select taxonomies for another post type, just go to its page). Now you can see the dropdown of the taxonomies you want to filter by. Selecting a term from the dropdown and click Apply to see the result.
One advantage of this plugin is it allows you to filter posts by multiple taxonomies at once. So you can combine the conditions to find the posts you need easier.
Admin Taxonomy Filter is a free plugin, you can download it from WordPress.org. And the source code is hosted on Github. Feel free to open an issue if you find any bug or want more features.
We also had a tutorial on how to filter posts by custom fields and custom taxonomies here.
Hello
My website has so many taxonomy, can you help me show only one taxonomy selected on wp admin edit post ?
current I set hidden taxonomy with show_ui is false
register_taxonomy(‘developer’, ‘post’, array(
‘hierarchical’ => true,
‘labels’ => $labels, /* NOTICE: Here is where the $labels variable is used */
‘show_ui’ => FALSE,
‘query_var’ => true,
‘rewrite’ => array(‘slug’ => ‘developer’),
));