Opened 2 years ago
Last modified 2 years ago
#56892 new defect (bug)
wp_xx_categories() doesn't pad counts correctly when a sub-category exists
Reported by: | wildworks | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
I fond this issue while researching gutenberg #37319(https://github.com/WordPress/gutenberg/issues/37319).
If I set the hierarchical
and show_count
of wp_list_categories
or wp_dropdown_categories
to true
, the counts for some categories aren't displayed correctly when there are posts that have grandchild categories.
Example:
wp_list_categories( array( 'show_count' => true, 'hierarchical' => true ) );
- Parent (4)
- Child 1 (3)
- Grandchild 1 (1)
- Child 2 (1)
- Child 1 (3)
wp_list_categories( array( 'show_count' => true, 'hierarchical' => false ) );
- Child 1 (2)
- Child 2 (1)
- Grandchild 1 (1)
"Child 1" category counts are different, but the second data (hierarchical
is false
) is correct in my test data.
For some reason, I think the number of grandchild categories is counted as well.
This problem is the same when I output with wp_dropdown_categories
.
Note: See
TracTickets for help on using
tickets.