How to programatically remove parent form taxonomy term? I try to remove programatically all parents form my taxonomy terms. But I can't get it working. I tried this code:

$vid = 18; 
$tree = taxonomy_get_tree($vid); 
foreach ($tree as $term) {
   $term-&gt;parents = null;  # Does not work
   $status = taxonomy_term_save($term);
}


But after saving (although the function returns 2) the parents are still there. What is wrong?
taxonomy_term_save() treats null as "do not change parent", and 0 means "this term does not have any parents". Also, property is named parent, not parents. Change

$term-&gt;parents = null; 


to

$term-&gt;parent = 0; 


and you're done.