Question

As the title says, how can I execute code after a taxonomy term is deleted. Drupal 7 has a hook_taxonomy_term_delete, but this function is not available for 6. Does anyone know a work around?

Was it helpful?

Solution

The corresponding hook in D6 is just called hook_taxonomy.

It is called thusly: hook_taxonomy($op, $type, $array = NULL) where:

  • $op is one of 'delete', 'insert', 'update'
  • $type is one of 'vocabulary', 'term',
  • and $array is the thing that $op is being done to.

So in your case an example implementation of that hook would go like this:

function example_taxonomy($op, $type, $array = NULL) {
    if ('term' == $type && 'delete' == $op) {
        // Execute the code here
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top