Hierarchical Categories
Hierarchical categories enable breadcrumb-style drill-down navigation in your search sidebar: click Clothing to see sub-categories, click T-Shirts to see only tees. Powered by item_list_element_N_name_sm Solr fields built automatically from your WordPress category tree β no configuration needed on the plugin side.
What You Get
Once configured, your search sidebar shows a drill-down facet. Visitors click any level to zoom in β a breadcrumb trail and back button keep navigation intuitive at every level:
How It Works
During ingestion, the plugin scans all hierarchical taxonomies registered on the post type. For each assigned term, it walks up the parent chain to the root, then assigns each level to a positional Solr field:
item_list_element_1_name_smβ root / top-level ancestor (depth 1)item_list_element_2_name_smβ second level (depth 2)item_list_element_3_name_smβ third level (depth 3)- … up to depth 6
You only assign a post or product to the most specific (leaf) category β the plugin finds all ancestors automatically via WordPress's get_ancestors() function. You do not need to also select parent categories.
The item_list_element_N_name_sm fields are built automatically during real-time sync and bulk ingestion. They appear in the Facet Configuration table automatically once content is ingested. The only setup required is building your category tree in WordPress and assigning posts to leaf categories.
Two Supported Category Types
Posts β WordPress Categories
Standard WordPress categories (the built-in category taxonomy). Use Posts → Categories in the admin to build the tree. Categories are hierarchical by default.
WooCommerce β Product Categories
WooCommerce product categories (product_cat taxonomy). Use Products → Categories to build the tree. Assign products to leaf categories β the plugin handles the full hierarchy chain automatically.
Step 1 β Build Your Category Tree
For posts β go to Posts → Categories:
- Add your top-level categories first (e.g., "Electronics", "Books")
- Add child categories β for each child, set the Parent Category dropdown to the appropriate parent
- Continue adding sub-levels as needed β up to 6 levels deep
For WooCommerce products β go to Products → Categories:
- Add your root product categories (e.g., "Clothing", "Electronics")
- Add child categories and set their Parent Category
- Continue for as many levels as needed (max 6)
Step 2 β Assign Posts / Products to Leaf Categories
When editing a post or product, select only the most specific (deepest) category that applies. Do not also check parent categories β that causes duplicate values at root depth levels.
For a post about gaming laptops: check "Gaming Laptops" only β do NOT also check "Laptops", "Computers", or "Electronics". The plugin automatically discovers "Electronics" (depth 1), "Computers" (depth 2), "Laptops" (depth 3), and "Gaming Laptops" (depth 4) by walking up the parent chain.
Step 3 β Ingest Your Content
The plugin picks up category hierarchies automatically during ingestion. No additional configuration is needed.
- Real-time sync β fires on
save_posthook. Every time you save or update a post, the category hierarchy is pushed immediately to Opensolr. - Bulk ingestion β go to the Data Ingestion tab and click Ingest All Now to re-process your full content library after adding or restructuring categories.
Solr Fields Produced
For a product assigned to "Gaming Laptops" (child of "Laptops" → "Computers" → "Electronics"), ingestion produces:
| Solr Field | Value (example) | Depth |
|---|---|---|
item_list_element_1_name_sm |
Electronics | 1 β root / top-level |
item_list_element_2_name_sm |
Computers | 2 β second level |
item_list_element_3_name_sm |
Laptops | 3 β third level |
item_list_element_4_name_sm |
Gaming Laptops | 4 β leaf (most specific) |
All fields use the _sm suffix β multi-valued string. If a post is assigned to multiple leaf categories from different branches, each chain is merged: values at each depth level accumulate across all branches.
Step 4 β Enable the Hierarchical Facet Widget
Once content is ingested, the item_list_element_* fields appear in the Facet Configuration table automatically.
- Go to Settings → Opensolr Search → Facet Mapping tab
- Find
item_list_element_1_name_smin the Facet Configuration section - Set the Widget column to Hierarchical
- Set a Display Label (e.g., "Category", "Department")
- Check the Enable checkbox to show the facet on the search page
- Save the configuration
The search page shows the drill-down facet automatically. You only configure the depth-1 field β the plugin detects all deeper item_list_element_N_name_sm fields automatically when rendering the hierarchical widget.
Custom Hierarchical Taxonomies
Any custom taxonomy registered with 'hierarchical' => true and attached to an enabled content type is picked up automatically. No plugin configuration needed β just register the taxonomy, build the tree, and assign posts to leaf terms.
Works with Crawler Too
The web crawler also builds item_list_element_N_name_sm fields from the JSON-LD BreadcrumbList the plugin outputs on each page. Both ingestion and crawler produce identical fields β the same hierarchical facet works regardless of how content was indexed.
Visit your site's /search/ page and click a top-level category in the sidebar β it should drill into sub-categories. See Facets & Filters for more on widget types, ordering, and configuration options.