node_save() null tid column
If you have one tid by node use:

$tid = 0;    
$newNode-&gt;taxonomy[0]-&gt;tid = $tid;


if the node can have more than one term use:

$tids = [0, 3, 4, 5];
$i = 0;
foreach ($tids as $tid) {
  $newNode-&gt;taxonomy[$i]-&gt;tid = $tid;
  $i++;
}