wp_set_object_terms() — prevent overwrite?

From my understanding (and before trial and error),

wp_set_object_terms( 'post_id', 'add_this_term', 'in_this_taxonomy');

But from the Codex, apparently adding the term will overwrite any other terms that are set for that post and that taxonomy?

Read More

Is this right? What if the terms are nested?

Related posts

Leave a Reply

2 comments

  1. wp_set_object_terms() has a fourth argument called append. Setting that to true during the call should add the term without unsetting the already set terms.

    wp_set_object_terms( $post_id, 'add_this_term', 'in_this_taxonomy', true);