Skip to content

Filter Custom Post Types by Taxonomy in WP Admin Dashbaord

Filter CPTs by a linked custom Taxonomy in the WP Admin Dashboard is possible with restrict_manage_posts.

Filter Cpt By Custom Taxonomy

In the screenshot there is a CPT list of posts, with a dropdown menu of a linked custom taxonomy terms which are filterable via the filter button next to it.

The code goes in functions.php

So change to your CPT – example uses ‘light’ and Custom Taxonomy – example uses ‘light_category’.

The action has a late priority of ’99’ so it ends up closer to the filter button in the dashboard.

2 Comments

  1. Max on June 17, 2019 at 3:55 pm

    how do we add another post type to the function, can I just add another post type to the if condition followed by a comma ? such as ” if ( ‘light’, ‘show’ !== $post_type) and adding the taxonomy here as well ( $taxonomies = array( ‘light_category’, ‘show_category’ );

  2. ROSEMARY on May 21, 2019 at 4:05 am

    it doesnt work. We created the custom taxonomies with CPT UI

Leave a Comment





Scroll To Top