How to programatically remove parent form taxonomy term?
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.