Make WordPress Core

Opened 11 years ago

Closed 10 years ago

Last modified 3 years ago

#5375 closed defect (bug) (invalid)

wp_update_term_count cleans the cache for all taxonomies

Reported by: tellyworth Owned by: tellyworth
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


wp_update_term_count() doesn't pass the taxonomy name on to clean_term_cache(). This causes clean_term_cache() to run some unnecessary queries and clear the cache for all taxonomies, not just the one with the updated count.

The enclosed patch fixes this. It reduces import queries by a few percent and might help speed up post saving slightly.

Attachments (1)

tax-term-count-fix-r6340.patch (994 bytes) - added by tellyworth 11 years ago.

Download all attachments as: .zip

Change History (6)

#1 @ryan
11 years ago

wp_update_term_count() is passing term_taxonomy_ids to clean_term_cache(), not term_ids. Taxonomy shouldn't be needed. Passing a taxonomy to clean_term_cache() when tt_ids are passed in $ids will result in the wrong IDs being cleaned. clean_term_cache() shouldn't clean any taxonomies not represented in the tt_ids being passed. I think something else is broken if we're cleaning extra taxonomies.

#2 @tellyworth
11 years ago

You're right - I think I have the root cause mixed up. I'll see if I can reproduce something in unit testing and post back with more info.

#3 @ryan
10 years ago

  • Owner changed from anonymous to tellyworth

#4 @ryan
10 years ago

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

#5 @DrewAPicture
3 years ago

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