[wp-trac] [WordPress Trac] #46768: Not working get_terms with parameters 'child_of' and 'fields'=>'id=>name'

WordPress Trac noreply at wordpress.org
Tue Apr 2 11:29:16 UTC 2019

#46768: Not working get_terms with parameters 'child_of' and 'fields'=>'id=>name'
 Reporter:  planvova      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  trunk
 Severity:  major         |   Keywords:  needs-patch
  Focuses:                |
 When I tried select all child terms from my category I had an error
 PHP Notice: Undefined property: stdClass::$parent in /wp-
 includes/taxonomy.php on line 3529

 I used
 $terms = get_terms(
 ['taxonomy' => 'my_taxonomy_name',
 'child_of' => TERM_ID,
 'fields' => 'id=>name']

 And I have empty result and notice on logs.
 If I remove parameter "fields", it works fine.
 Or if change 'fields' to 'ids' or 'names'.

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

More information about the wp-trac mailing list