"set" version of field_get_items? One can retrieve field items from an entity with

// Find all terms on $node in field 'field_tags'.
$terms = field_get_items('node', $node, 'field_tags');


But is there a convenient way to do the reverse, Core, or otherwise?

// Attach new term $term to $node in field 'field_tags'.
$term = taxonomy_term_load($tid);
$node = field_set_items('node', $node, 'field_tags', 'taxonomy_term', $term);
node_save($node);


I would like to avoid the hassle of manually assigning a $term, go look in devel what the array structure looks like and then build the array by hand, as it is sometimes non-trivial.

The only issue in the core queue I could find that looked vaguely similar was about the field language api DX.
No, there is no such function.

See my comment at Language support for entity fields.