Hierarchical Filters – Use Parent/Child Levels Option
This document explains how the Use Parent/Child Levels option works in the Divi FilterGrid plugin.
In WordPress, taxonomies can support hierarchical terms or not. Post categories are an example of a taxonomy that has hierarchical support. When creating a new category, you can choose to make the category a child of another category. Post tags are an example of a taxonomy that does NOT have hierarchical support. When creating a new tag, it is not possible to make the tag a child of another tag.
Divi FilterGrid can filter either type of taxonomy – hierarchical or non-hierarchical. It can also filter by multiple taxonomies when the Query Options -> Query Type is set to anything other than Basic. Multiple taxonomies can be added to the same level of buttons or dropdown filters (default), or each taxonomy can be added to a separate level or dropdown by turning on the Use MultiLevel Filters option.
Once the Use MultiLevel Filters option is turned on, the Use Parent/Child Levels option will appear immediately below it. Turning this option on will auto create multiple filter levels based on the chosen taxonomy (default is post category).
For example, if a custom taxonomy is not selected in the module’s Parent/Child Taxonomy option, the first level of filters will contain all parent post categories. Once a category is selected, the grid will update to display posts in that category and the next filter level will appear. This next level will contain any child categories of the selected parent category. Once a child category from the second level of terms is selected, the grid will again update to display posts in that child category and the next filter level will appear. This process will repeat until there are no longer any child categories left to display.
There are a few important things to note when turning on the Use Parent/Child Levels option:
- This option will only work with a single taxonomy
- This option is not compatible with the Use MultiSelect Filters option
- Posts must be assigned all levels of a term to be displayed. Assigning a post to a child category but not the parent category will not work.