Overview
Taxonomy Hierarchy Rebuild is a utility module for Backdrop CMS that automatically recalculates and fixes the internal hierarchical ordering fields (hweight and hdepth) for taxonomy terms.
It is designed to solve issues where newly created terms are not displayed correctly in hierarchical Views, menus, or custom templates due to missing or zero values in these fields.
The problem this module solves
Backdrop stores taxonomy hierarchy in two different ways:
-
Parent–child relationships in the table
taxonomy_term_hierarchy -
Cached numeric hierarchy data in
taxonomy_term_data:-
hdepth– depth of the term in the hierarchy -
hweight– ordering position used by Views and other queries
-
In some setups (especially when using custom Views fields, hierarchy modules, multilingual taxonomies, or older contributed modules), newly created terms may end up with:
-
hweight = 0 -
hdepth = 0
even when the term has a parent.
This causes problems such as:
-
New terms appearing at the wrong position
-
Terms not showing under their parent
-
Broken hierarchical menus
-
Incorrect ordering in Views
-
Filters and navigation menus breaking after adding a new term
What this module does
The module rebuilds correct hierarchy data by:
-
Reading real parent–child relations from
taxonomy_term_hierarchy -
Calculating correct depth (
hdepth) -
Assigning proper ordering (
hweight) while preserving existing term order -
Updating all terms in
taxonomy_term_data
Features
✅ Automatically rebuilds hierarchy when:
-
A term is created
-
A term is edited (parent changed)
-
Cron runs
✅ Manual rebuild interface:
-
Admin page:
/admin/structure/taxonomy/hierarchy-rebuild
✅ Preserves:
-
Existing parent–child relationships
-
Existing term ordering (taxonomy weight)
-
Multilingual terms (langcode does not matter)
✅ Safe for large vocabularies
Typical use cases
This module is especially useful when using:
-
Hierarchical taxonomy menus built with Views
-
Custom Views templates using
hdepthorhweight -
Filtering menus based on taxonomy hierarchy
-
Multilingual taxonomies (i18n)
-
Modules that extend taxonomy ordering
Recommended module combinations
This module is commonly needed when using setups with:
-
Views
-
Taxonomy
-
i18n_taxonomy or multilingual vocabularies
-
views_term_hierarchy_weight_field
-
Custom taxonomy-based navigation menus
-
Custom taxonomy Views templates
-
Older Drupal → Backdrop migrated sites
It is particularly helpful if you experience hierarchy or ordering issues after:
-
Adding new taxonomy terms
-
Migrating from Drupal
-
Enabling multilingual taxonomy
-
Installing hierarchy-related contributed modules
Notes
This module does not modify:
-
Term names
-
Parent relationships
-
Translations
-
Vocabulary configuration
It only recalculates cached hierarchy fields to ensure consistent behavior across Views and menus.
Link for download: https://rdesign.sk/mnews/data/files/others/taxonomy_hierarchy_rebuild.zip
Comments
Why not place this module in the Backdrop CMS contrib repo? I wouldn't download this module from a 3rd party location, as there are no guarantees this is a legitimate module, or rather some malicious code that may harm your site...