[wp-trac] [WordPress Trac] #18628: wp_insert_term bug doesn't update edit-tags.php right side tree

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 10 13:18:11 UTC 2011


#18628: wp_insert_term bug doesn't update edit-tags.php right side tree
---------------------------+------------------------------
 Reporter:  justindgivens  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Taxonomy       |     Version:  3.2.1
 Severity:  minor          |  Resolution:
 Keywords:                 |
---------------------------+------------------------------

Comment (by duck_):

 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.

 I'm afraid I cannot think of a ''nice'' workaround right now.

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


More information about the wp-trac mailing list