The function wp_set_post_terms()
works fantastically however I’m looking to add some terms to a post at a later date. I’ve tried using wp_set_post_terms()
and wp_set_object_terms()
but they just overwrite what’s already there. I thought wp_add_object_terms()
was the answer to my question but it has the same functionality whereby overwriting the original terms.
Any way to append terms via code?
However,
wp_set_object_terms();
seems made for your case:From WordPress Codex:
The clue
$append
parameter is bool: if true, tags will be appended to the object. If false, tags will replace existing tagsHope it helps!