get_terms bug: pad_counts doesn't work if you specify parent
|Reported by:||yeswework||Owned by:|
I'm not sure if this is related to #13176 or not.
Anyway, to explain the bug with an example:
Let's say you want to retrieve, via get_terms, a list of the top level categories only (by setting parent=0), but that you want the counts to include any posts assigned to subcategories too (pad_counts=1).
This doesn't work: as soon as you specify parent=, it stops including the subcategory count within the parent categories. A bug, surely?
I've traced the cause to line 842 of taxonomy.php, where it checks
if ( !== $argsparent?)
and if so, sets pad_counts back to 0.
Why is that check needed at all?
Change History (8)
- Keywords 2nd-opinion added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 3.1 to 2.8
- Type changed from defect (bug) to enhancement
- Version changed from 3.0.1 to 2.8