#11166 closed defect (bug) (invalid)
wp_set_object_terms() Deletes All New Tags
Reported by: | miqrogroove | Owned by: | filosofo |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8.4 |
Component: | Taxonomy | Keywords: | needs-patch |
Focuses: | Cc: |
Description
While working on #10543, I noticed a logic flaw in function wp_set_object_terms().
The call to $wpdb->insert() is logically incoherent with the default argument $append = false. Any such occurrence results in the inserted tags being deleted, due to failure to modify the $old_tt_ids array.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Sorry, description was not accurate. The problem is actually caused if wp_set_object_terms() is called more than one time. It appears $old_tt_ids is taking a cached value, so if any previous calls to this function added new tags, they will be deleted on any successive calls.
This is probably unlikely to happen in the wild. One possible trigger is if someone writes a custom agent that creates new posts by posting values for both tags_input and tax_input.