Programmatically add more than one taxonomy term in Drupal 7 Just a quick question. I'm creating a node and adding a term to the node like this:

 $newNode-&gt;field_tags[$newNode-&gt;language][]['tid'] = "a digit here";


Fine, but how do I add more than one term per node? I've tried a comma-separated string of digits and an array of digits but neither work.
You can just keep adding to the array the way you're already doing:

$newNode-&gt;field_tags[$newNode-&gt;language][]['tid'] = "a digit here";
$newNode-&gt;field_tags[$newNode-&gt;language][]['tid'] = "another digit here";


Or you could loop instead:

$tids = array(1, 2, 3);
foreach ($tids as $tid) {
  $newNode-&gt;field_tags[$newNode-&gt;language][]['tid'] = $tid;
}