1

I work on a D7 website where some taxonomy terms were created and then deleted.

I’ve build a search form with views based on taxonomy terms (filter criterion: Content: Term name (field_term_name)) and i see some "deleted" terms in filter exposed to visitor.

I’ve check directly in DB and it appears that these datas (which should be completely deleted) are still in taxonomy_term_data.

I do not see these terms in the Drupal admin but I can however still see them in the database, and I can open them directly using the tid in the Drupal interface.

My experience with Drupal let me think that is not a good idea to delete them directly in DB. So how can I proceed ?

0

taxonomy_term_data is the canonical location for term data so it sounds like there might be other issues going on (a broken admin display, caching, DB corruption via orphaned parent/child term, we can only guess).

If you want a safe way to remove taxonomy, invoke the taxonomy API functions (they are the same tools the admin interface is using) via Devel, drush eval, or some other dev tool where you can execute arbitrary PHP that uses these functions to remove your desired terms:

For example:

$my_bad_tids = [1, 2, 3];
$terms = taxonomy_term_load_multiple($my_bad_tids);
foreach ($terms as $term) { 
  taxonomy_term_delete($term->tid);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.