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

WordPress Trac noreply at wordpress.org
Sun Dec 2 21:00:37 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        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by mh35):

 If I pass only taxonomy and child_of parameter, this function returns
 direct and indirect children.
 {{{#!php
 <?php
 get_terms(array('taxonomy' => 'category', 'hide_empty' => false,
 'child_of' => 1));
 }}}
 This returns C1, C3, C4, C5, C2, C6 and C7. If I want to get only direct
 children, I pass parent parameter.
 {{{#!php
 <?php
 get_terms(array('taxonomy' => 'category', 'hide_empty' => false, 'parent'
 => 1));
 }}}
 This returns C1 and C2.

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


More information about the wp-trac mailing list