[wp-hackers] Bug in get_categories when asking for category
children?
Knut-Olav Hoven
hovenko at linpro.no
Thu Aug 30 11:30:04 GMT 2007
Added a ticket.
I do not have a patch yet.
http://trac.wordpress.org/ticket/4870
On Thursday 30 August 2007 13:21:32 Knut-Olav Hoven wrote:
> 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:
> ## CODE ##
> $cat_children = get_categories(
> array(
> 'child_of' => 1,
> 'hide_empty' => false,
> );
> );
>
> print_r($cat_children);
> ## CODE END ##
>
>
> 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.
>
>
> What I want/need is the function to return an empty list, simply because
> cat1 doesn't have any children.
--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
More information about the wp-hackers
mailing list