WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#30700 closed defect (bug) (invalid)

get_terms throws PHP notice when fields is set to 'id=>name'

Reported by: webgeekconsulting Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0.1
Component: Taxonomy Keywords:
Focuses: Cc:

Description

The following code will raise a notice in PHP version 5.3.27

get_terms( 'category', array( 'fields' => 'id=>name' ) );

Notice: Undefined property: stdClass::$count in wp-includes/taxonomy.php on line 1590

It seems this is because the field "count" is not returned as part of the result set.

Change History (1)

#1 @boonebgorges
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

In 4.1, 'count' will be selected for all values of 'fields'. See [29845] #29859. So this problem should disappear.

Note: See TracTickets for help on using tickets.