我正在尝试以编程方式将一些标签添加到节点的免费标记分类字段中。假设我有以下节点结构,
<?php
$my_tag = 'test';
$node = (object) array(
'type' => $node_type,
'nid' => $row->nid,
'vid' => $row->vid,
'uid' => 1,
'status' => $row->status,
'language' => $row->language,
'created' => $row->created,
'changed' => $row->changed,
'comment' => $row->comment,
'promote' => $row->promote,
'title' => $row->title,
'teaser' => $row->teaser,
'field_custom_tags' => //TODO add $my_tag to this free tagging taxonomy field
);
$node = node_submit($node);
node_save($node);
?>