You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wp post term set --by=id with a non-existent ID removes all terms and reports success #690
wp post term set <id> <taxonomy> <term-id> --by=id removes every term from the object when none of the given IDs exist, and still prints Success:
$ wp post term add 1 post_tag apple banana
Success: Added terms.
$ wp post term set 1 post_tag 9999 --by=id
Success: Set term.
$ wp post term list 1 post_tag --format=count
0
CommandWithTerms::prepare_terms() drops IDs that do not match a term. When none match, set() calls wp_set_object_terms( $id, [], $taxonomy, false ), which replaces the existing terms with nothing. wp post term add --by=id takes the same path: it adds nothing and prints Success: Added term.. wp user term set|add use the same class.
Expected: an error, and the existing terms stay as they are.
Activity