#4870 closed defect (bug) (wontfix)
Bug in get_categories when asking for category children
Reported by: | hovenko | Owned by: | ryan |
---|---|---|---|
Milestone: | Priority: | high | |
Severity: | major | Version: | 2.2.2 |
Component: | General | Keywords: | categories |
Focuses: | Cc: |
Description (last modified by )
When asking for categories that are child of another category (cat1) and to
include empty categories I get different behaviour wether cat1 has children
or not.
Take the following code:
$cat_children = get_categories( array( 'child_of' => 1, 'hide_empty' => false, ); ); print_r($cat_children);
Scenario 1:
I have the following categories:
1 - cat1 (no parent)
2 - cat2 (no parent)
3 - cat3 (parent:1)
In this case it prints out cat3.
Scenario 2:
I have the following categories:
1 - cat1 (no parent)
2 - cat2 (no parent)
In this case it prints out cat1 and cat2.
Expected behaviour is to get an empty list, simply because cat1
doesn't have any children.
Attachments (1)
Change History (8)
#4
@
17 years ago
I don't understand why the milestone was changed to 2.3. This is the time for fixing bugs, right? From my point of view, this is a bug.
2.3 is due on September 24th, There may be a 2.2.3 release before then, but i'm not sure.
Since its dealing with Categories, and we've got a new category backend in 2.3, it'd make sense to simply focus the testing on the new stuff instead.
I cant reproduce the issue in 2.3 either, So it looks to me its fixed there.
2.3 Release Info: http://comox.textdrive.com/pipermail/wp-hackers/2007-August/013962.html
#5
@
17 years ago
- Milestone changed from 2.3 to 2.2.3
DD32, thanks for testing this in 2.3! Since you say it doesn't repro, changing milestone back to 2.2.3 .
I don't understand why the milestone was changed to 2.3. This is the time for fixing bugs, right? From my point of view, this is a bug.
I believe the fix is as simple as checking if both the category hierarchy is empty and "child_of" is set, then return an empty array.