3
我試圖以編程方式向節點的免費標記分類標記字段中添加一些標記。 假設我有以下節點結構,Drupal 7 - 以編程方式向節點添加自由標記
<?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);
?>
檢查這個職位:HTTP://計算器.com/questions/4985779/drupal-7-insert-taxonomy-into-node-object?rq = 1 – FLY