Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34338 closed defect (bug) (fixed)

wp_remove_object_terms() should call wp_cache_delete() like wp_set_object_terms()

Reported by: tszming Owned by: boonebgorges
Priority: normal Milestone: 4.4
Component: Taxonomy Version: 3.6
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

If you call get_the_terms() after wp_remove_object_terms(), cached terms will be returned.

Failed:

wp_remove_object_terms($id, 'test', 'mycategory');
$terms = get_the_terms($id, 'mycategory');

Ok:

wp_set_object_terms($id, null, 'mycategory');
$terms = get_the_terms($id, 'mycategory');

wp_cache_delete() need to be place inside the wp_remove_object_terms() like wp_remove_object_terms()

Attachments (2)

Test_34338.php​ (601 bytes ) - added by tszming 11 years ago.
Test
taxonomy.diff​ (588 bytes ) - added by tszming 11 years ago.
Patch

Download all attachments as: .zip

Change History (6)

#1 @swissspidy
11 years ago

  • Component General → Taxonomy
  • Keywords needs-patch needs-unit-tests added
  • Version 4.3.1 → 3.6

@tszming
11 years ago

Test

@tszming
11 years ago

Patch

#2 @swissspidy
11 years ago

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

@boonebgorges Since you're a component maintainer, would you mind having a look at this?

#3 @boonebgorges
11 years ago

  • Milestone Awaiting Review → 4.4

Thanks for the ticket and the patch, tszming!

#4 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolution → fixed
  • Status new → closed

In 35268:

Bust object term cache in wp_remove_object_terms().

Props tszming.
Fixes #34338.

Note: See TracTickets for help on using tickets.