[wp-trac] [WordPress Trac] #16051: $taxonomy_children option is not updated after wp_insert_term

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 31 11:13:16 UTC 2010


#16051: $taxonomy_children option is not updated after wp_insert_term
--------------------------+-----------------------------
 Reporter:  acsnaterse    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  3.1
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 When using wp_insert_term or wp_update_term the $taxonomy_children option
 is not set properly. This should be done in the {{{ _get_term_hierarchy
 }}} function, but I think the following line gives a problem:

 {{{
 if ( is_array($children) )
         return $children;
 }}}

 It checks whether it's an array or not, but this means when the array is
 empty (due to manually deleting all the terms in the Admin) it also
 returns. And therefor it doesn't update anymore.

 I think the check must be whether it's an array or not and if it is, it
 should also check whether the array is empty or not. So something like
 this:

 {{{
 if ( is_array($children) && !empty($children) )
         return $children;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16051>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list