Make WordPress Core

Opened 10 months ago

Last modified 9 months ago

#46768 new defect (bug)

Not working get_terms with parameters 'child_of' and 'fields'=>'id=>name'

Reported by: planvova Owned by:
Milestone: Future Release Priority: normal
Severity: major Version: 3.7
Component: Taxonomy Keywords: needs-patch needs-unit-tests
Focuses: Cc:
PR Number:


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'.

Change History (1)

#1 @SergeyBiryukov
9 months ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 3.7

Hi @planvova, welcome to WordPress Trac! Thanks for the report.

Introduced in [25161].

Note: See TracTickets for help on using tickets.