Opened 16 years ago
Closed 16 years ago
#7213 closed defect (bug) (fixed)
get_terms caching ignores filters
Reported by: | filosofo | Owned by: | |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.6 |
Component: | General | Keywords: | has-patch wp_cache_set get_terms |
Focuses: | Cc: |
Description
get_terms sets the cache for a terms query, serializing the default query args and their values as the cache key, so that in theory there will be different cache keys for each get_terms query.
However, get_terms calls wp_cache_set before the 'list_terms_exclusions' filter is called, meaning that anything done by those callbacks on that filter will not result in distinct cache keys.
My patch serializes the callbacks for 'list_terms_exclusions', if there are any, and adds it to the cache key.
I looked grepped through the rest of core WP and could not find any other similar situations, i.e. situations where the cache is set before filters are called.
BTW, this bug was difficult to track down and so might be difficult to reproduce, because a number of different situations cause the cache to be flushed, meaning that the bug's appearance is sporadic.
(In [8225]) Account for term exclusion filter when creating cache key. Props filosofo. fixes #7213