How replace a node term programmatically? I have a vocabulary (this is a workflow vocabulary) and another vocabulary attach to a node.

How can I replace workflow term by single another workflow term without change some other vocabulary ?

Something like this ?

$old_terms = taxonomy_node_get_terms_by_vocabulary($node, 23);
foreach($old_terms as $tid =&gt; $old_term){
  unset($node-&gt;taxonomy[$tid]);
}
$new_term = taxonomy_get_term(30);
$node-&gt;taxonomy[$new_term-&gt;tid] = $new_term;
node_save($node);
you can add term using term id(tid) $node-&gt;field_yourfield_name[$node-&gt;language][0]['tid'] = $tid in D7