[wp-trac] [WordPress Trac] #45457: get_terms returns incorrect terms set for indirect children

WordPress Trac noreply at wordpress.org
Sat Dec 1 13:07:15 UTC 2018


#45457: get_terms returns incorrect terms set for indirect children
--------------------------+-----------------------------
 Reporter:  mh35          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  4.9.8
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I created categories as below.

 未分類(term_id=1) has two children, C1(term_id=2) and C2(term_id=3).\\
 C1 has three children, C3(term_id=4), C4(term_id=5) and C5(term_id=6).\\
 C2 has two children, C6(term_id=7) and C7(term_id=8).

 If I query as below, it returns correct answer.
 {{{#!php
 <?php
 get_terms(array('taxonomy' => 'category', 'hide_empty' => false, 'name' =>
 'C1', 'child_of' => 1));
 }}}
 This query returns C1 term.

 But I query as below, it returns no terms. I think this behavior is
 incorrect.
 {{{#!php
 <?php
 get_terms(array('taxonomy' => 'category', 'hide_empty' => false, 'name' =>
 'C4', 'child_of' => 1));
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45457>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list