You can filter Views Queries using taxonomy. This lets you load specific content, arranged using tags, categories and custom taxonomy.
In the View Query Filter section, click on Add filter. You’ll see different filter options. Choose one of the taxonomy to get to this dialog:
The taxonomy can be set by one of the following:
Taxonomy setting | Usage |
---|---|
Any of the following | Choose taxonomy values from the checkboxes (like in the screenshot above). This is good in cases where you want to load posts that belong to specific taxonomy. |
NOT one of the following | Return posts that don’t belong to any of the selected taxonomy terms. |
All of the following | Return posts that belong to all the selected taxonomy terms. |
Value set by the current page where this View is shown | The View is always inserted somewhere. That page where the View is inserted is responsible for setting the taxonomy term. This is good when you want the same View to return different results, according to the page it’s inserted to. |
Value set by View shortcode attribute | Enter the name of the attribute in the second argument. You can add multiple values separated by a comma, and set the operator that will be used in the filter: IN (posts related to any of the taxonomy terms), NOT IN (posts related to none of the taxonomy terms) or AND (post related to all of the taxonomy terms). When you insert the View to page content, you’ll need to add that attribute to the shortcode and set it’s value there. This is good if you want to reuse the same View and get different results, depending on arguments that you set when inserting the View. See the documentation about passing arguments to Views. |
Value set by URL parameter | Enter the name of the URL parameter in the second argument. If you add a custom search by a taxonomy, this filter will be added automatically. You can filter by multiple values, so you can set the operator that will be used: IN, NOT IN or AND. See the documentation about passing arguments to Views. |
Value set by parent Taxonomy View | Use this setting when you’re creating nested Views and you want this inner View to inherent the taxonomy filtering from the parent View. |
Value set by the current post in the loop | Use this setting when you’re creating nested Views and you want this inner View to inherent the taxonomy filtering from the post in the loop of the parent Post View. |
Value set by current archive page | Use this setting when you’re adding this Views inside a term archive page and you want it to inherent the taxonomy filtering from the archive term. |