[wp-trac] [WordPress Trac] #14485: Taxonomy hierarchy cache isn't properly refreshed

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 11 11:39:44 UTC 2012


#14485: Taxonomy hierarchy cache isn't properly refreshed
-------------------------------------+-----------------------------
 Reporter:  thealien                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  high                     |   Milestone:  Future Release
Component:  Cache                    |     Version:  3.0
 Severity:  major                    |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------

Comment (by scribu):

 Worth reposting duck_'s explanation:

 > The problem you're facing is caching. wp_insert_term() will call
 functions to clear out the cache that stops the hierarchy displaying
 properly (clean_term_cache() -> _get_term_hierarchy()). So if you were to
 only add one term all would be okay. However, you're inserting multiple
 terms on a single page load...

 > * clean_term_cache() contains some code, in the form of a static
 variable, to stop a taxonomy's hierarchy being rebuilt multiple times on a
 single page load.
 > * because the code executes so fast the last_changed cache item in the
 terms group will not actually be changed on every term insert. Therefore,
 even if the above didn't occur, the result of get_terms() would be cached
 and only include the first term to be inserted (and any which existing
 prior) so _get_term_hierarchy() will return 'incorrect' information.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14485#comment:57>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list