[wp-trac] Re: [WordPress Trac] #4870: Bug in get_categories when
asking for category children
WordPress Trac
wp-trac at lists.automattic.com
Thu Aug 30 14:58:40 GMT 2007
#4870: Bug in get_categories when asking for category children
------------------------+---------------------------------------------------
Reporter: hovenko | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.3
Component: General | Version: 2.2.2
Severity: major | Resolution:
Keywords: categories |
------------------------+---------------------------------------------------
Changes (by foolswisdom):
* milestone: 2.2.3 => 2.3
Old description:
> 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:[[BR]]
> I have the following categories:
> 1 - cat1 (no parent)[[BR]]
> 2 - cat2 (no parent)[[BR]]
> 3 - cat3 (parent:1)
>
> In this case it prints out cat3.
>
>
> Scenario 2:[[BR]]
> I have the following categories:
> 1 - cat1 (no parent)[[BR]]
> 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.
New description:
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:[[BR]]
I have the following categories:
1 - cat1 (no parent)[[BR]]
2 - cat2 (no parent)[[BR]]
3 - cat3 (parent:1)
In this case it prints out cat3.
Scenario 2:[[BR]]
I have the following categories:
1 - cat1 (no parent)[[BR]]
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.
--
Ticket URL: <http://trac.wordpress.org/ticket/4870#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list