WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#5375 closed defect (bug) (invalid)

wp_update_term_count cleans the cache for all taxonomies

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

Description

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 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 ryan6 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.

comment:2 tellyworth6 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.

comment:3 ryan6 years ago

  • Owner changed from anonymous to tellyworth

comment:4 ryan6 years ago

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.