[wp-trac] [WordPress Trac] #29624: wp_set_object_terms function append flag not working and overwriting existing terms

WordPress Trac noreply at wordpress.org
Thu Oct 23 13:56:33 UTC 2014


#29624: wp_set_object_terms function append flag not working and overwriting
existing terms
--------------------------+----------------------
 Reporter:  rxnlabs       |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Taxonomy      |     Version:  4.0
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 I can't reproduce this. See the tests introduced in [29997].

 I agree that the logic of the `$append` check at the beginning of
 `wp_set_object_terms()` seems a bit contradictory. But here's what's
 happening: The only place where these `$old_tt_ids` are used is later in
 the function, when deciding which old terms to delete. An `array_diff()`
 is run between `$old_tt_ids` and the tt_ids of the added terms, and the
 results of this diff are removed from the object. In other words: it's
 only when we are *not* appending that we ever need to delete any term
 relationships. See https://core.trac.wordpress.org/browser/tags/4.0/src
 /wp-includes/taxonomy.php#L2683.

 Going to close this one. If you continue to have problems, feel free to
 reopen with new details. Thanks for the report!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29624#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list