WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

#16240 closed defect (bug) (invalid)

hide_empty doesn't work in get_terms() when hierarchical isn't set to false

Reported by: markjaquith Owned by: markjaquith
Milestone: Priority: high
Severity: major Version:
Component: Taxonomy Keywords: close
Focuses: Cc:

Description

I end up with some 0-count categories when calling get_terms( 'category', array( 'hide_empty' => true ) )

I think it has to do with the child count logic.

Change History (4)

comment:1 wonderboymusic19 months ago

  • Keywords reporter-feedback added; 3.2-early removed

I can't reproduce the issue - any use cases?

comment:2 SergeyBiryukov19 months ago

With both hierarchical and hide_empty set to true, empty categories are only returned if they have non-empty children.

There's a block in get_terms() for that (introduced in [4104]):
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/taxonomy.php#L1402

comment:3 nacin19 months ago

  • Keywords close added
  • Status changed from new to assigned

Seems deliberate then.

comment:4 wonderboymusic8 months ago

  • Keywords reporter-feedback removed
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

Nacin marked close 11 months ago, no chatter since then

Note: See TracTickets for help on using tickets.