Opened 2 years ago

Last modified 6 weeks ago

#15919 accepted defect (bug)

wp_count_terms() hide_empty not working

Reported by: zeo Owned by: markjaquith
Priority: high Milestone: 3.6
Component: Taxonomy Version:
Severity: major Keywords: has-patch
Cc:

Description

For tax category, wp_count_terms( 'category', array( 'hide_empty' => true ) ) returns all category and doesn't hide category with post count 0. Instead need to use wp_count_terms( 'category', array( 'hide_empty' => true, 'hierarchical' => false ) ).

Since hide_empty=false is the default args, wp_count_terms() should set hierarchical=false by default too.

Attachments (4)

15919.diff (353 bytes) - added by zeo 2 years ago.
15919.002.diff (392 bytes) - added by markjaquith 2 years ago.
patch at a deeper level
15919.2.diff (392 bytes) - added by wonderboymusic 4 months ago.
15919_3.diff (446 bytes) - added by faishal 6 weeks ago.
updated patch

Download all attachments as: .zip

Change History (12)

zeo2 years ago

  • Milestone changed from Awaiting Review to 3.1
  • Owner set to markjaquith
  • Status changed from new to accepted

Bug reproduced. Patch fixes it. In it goes.

Version 0, edited 2 years ago by markjaquith (next)

Is this a regression?

comment:3   dd322 years ago

  • Component changed from General to Taxonomy
  • Keywords 3.2-early added
  • Milestone changed from 3.1 to Future Release
  • Priority changed from normal to high
  • Severity changed from normal to major

This is not a regression from 3.0, so I'm going to do it 3.2-early.

patch at a deeper level

Closed #19340 as a duplicate.

  • Milestone changed from Future Release to 3.6

Refreshed against trunk just so the line numbers match - this is from the class of 3.2-early

faishal6 weeks ago

updated patch

  • Keywords 3.2-early removed

Generally, a refresh is only needed when the patch no longer applies cleanly.

Line numbers may be off, but as long as the content is the same, the patch should still apply cleanly. 15919.2.diff is still fine.

Also, when copying code directly from Trac, make sure to remove trailing whitespace.

Note: See TracTickets for help on using tickets.