Error: Call to undefined method Drupal\taxonomy\TermStorage::deleteTermHierarchy()Error: Call to undefined method Drupal\taxonomy\TermStorage::deleteTermHierarchy()

Created on 18 July 2025, about 2 months ago

When trying to delete taxonomy terms using Taxonomy Manager (without checking "Delete children of selected terms"), the following error occurs:

Error: Call to undefined method Drupal\taxonomy\TermStorage::deleteTermHierarchy() in Drupal\taxonomy_manager\TaxonomyManagerHelper->deleteTerms() (line 272 of /opt/httpd/htdocs/staging/arrpracticed11/master/web/modules/contrib/taxonomy_manager/src/TaxonomyManagerHelper.php).

The method `deleteTermHierarchy()` (and `updateTermHierarchy()`) do not exist in Drupal core's `TermStorage` class.

Proposed Fix:

Remove these lines from `TaxonomyManagerHelper.php`
After doing this, the child terms are retained and their parent is correctly reset to target_id => 0.

this->taxonomyTypeManager->deleteTermHierarchy([$child->id()]);
$this->taxonomyTypeManager->updateTermHierarchy($child);
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India ali rizvi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024