Wednesday, 2 August 2017

Filtering Post Types by Taxonomies in the Dashboard


By default, the admin Posts screen allows us to filter posts by the built-in “Categories” Taxonomy, using a neat, user-friendly dropdown menu. But in many cases, when we register new Taxonomies we often want to be able to filter posts by these new Taxonomies as well. In this quick tutorial, we will learn how to add new filters (dropdowns) to any Post Type screen in order to filter content by custom Taxonomies. Registering a New Post Type and Taxonomies
For many WordPress developers this is a basic step, we do it in almost every project. Therefore, we won’t be getting into how to set it all up in your code — instead, use the following links to navigate to the snippets. You can use the Post Type Generator and the Taxonomy Generator to do that.
Ok, so in our example we will create a car catalog for an imaginary car retailer or agency. We will create a new “Car” post type and add several taxonomies (manufacturer, model, transmission, doors and color).
Adding Filters to the Post Type Admin Screen
Now that we have a working “Car” Post Type with several Taxonomies, we would like to be able to filter our cars in the admin area. For that we need
Source: https://managewp.org/articles/15771/filtering-post-types-by-taxonomies-in-the-dashboard




source https://williechiu40.wordpress.com/2017/08/02/filtering-post-types-by-taxonomies-in-the-dashboard/

No comments:

Post a Comment