wp_add_object_terms() WP 3.6.0
Add term(s) associated with a given object.
No Hooks.
Return
Array/WP_Error. Term taxonomy IDs of the affected terms.
Usage
wp_add_object_terms( $object_id, $terms, $taxonomy );
- $object_id(int) (required)
- The ID of the object to which the terms will be added.
- $terms(string/int/array) (required)
- The slug(s) or ID(s) of the term(s) to add.
- $taxonomy(array/string) (required)
- Taxonomy name.
Changelog
Since 3.6.0 | Introduced. |
Code of wp_add_object_terms() wp add object terms WP 5.6
function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
}