Adds term(s) associated with a given object.
Parameters
$object_id
intrequired- The ID of the object to which the terms will be added.
$terms
string|int|arrayrequired- The slug(s) or ID(s) of the term(s) to add.
$taxonomy
array|stringrequired- Taxonomy name.
Source
function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
}
Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
Set categories for an attachment