wp_add_object_terms()
Adds 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. |
wp_add_object_terms() wp add object terms code WP 6.5.2
function wp_add_object_terms( $object_id, $terms, $taxonomy ) { return wp_set_object_terms( $object_id, $terms, $taxonomy, true ); }