Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 10 years ago

#11166 closed defect (bug) (invalid)

wp_set_object_terms() Deletes All New Tags

Reported by: miqrogroove's profile miqrogroove Owned by: filosofo's profile 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)

#1 @miqrogroove
15 years ago

  • Priority changed from high to normal

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.

#2 @miqrogroove
15 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Sorted, nevermind _

#3 @DrewAPicture
10 years ago

  • Milestone 2.9 deleted
Note: See TracTickets for help on using tickets.