taxonomy_get_parents_all
- Versions
- 4.6 – 7
taxonomy_get_parents_all($tid)
Find all ancestors of a given term ID.
Code
modules/taxonomy/taxonomy.module, line 600
<?php
function taxonomy_get_parents_all($tid) {
$parents = array();
if ($term = taxonomy_term_load($tid)) {
$parents[] = $term;
$n = 0;
while ($parent = taxonomy_get_parents($parents[$n]->tid)) {
$parents = array_merge($parents, $parent);
$n++;
}
}
return $parents;
}
?>Login or register to post comments 