taxonomy_node_save
- Versions
- 4.6 – 5
taxonomy_node_save($nid, $terms)- 6
taxonomy_node_save($node, $terms)
Save term associations for a given node.
Code
modules/taxonomy.module, line 491
<?php
function taxonomy_node_save($nid, $terms) {
taxonomy_node_delete($nid);
if (is_array($terms)) {
foreach ($terms as $term) {
if (is_array($term)) {
foreach ($term as $tid) {
if ($tid) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $tid);
}
}
}
else if ($term) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $term);
}
}
}
}
?>Login or register to post comments 