[wp-testers] get_categories hierarchical not working

Nathan Rice ncrice at gmail.com
Wed Jun 10 15:34:13 GMT 2009


Then perhaps hierarchical means something different in get_categories than
it does in get_posts. It was my understanding that the hierarchical argument
was a sorting mechanism, returning child categories (and other descendants)
directly after their parents. For example:

(array)
Parent
Child
Grandchild
Child 2
Another Parent
Child
Yet Another Parent

That's what the argument does for get_pages at least. The Codex page
indicates that as well:
"Display sub-categories as inner list items (below the parent list item) or
inline."

@Demetris

Here's the exact call I'm making:
$categories = get_categories('hide_empty=0&hierarchical=1');

My Website
http://www.nathanrice.net/

My Twitter
http://twitter.com/nathanrice


On Wed, Jun 10, 2009 at 11:18 AM, Austin Matzko <if.website at gmail.com>wrote:

> On Wed, Jun 10, 2009 at 9:54 AM, Nathan Rice<ncrice at gmail.com> wrote:
> > I was working with the get_categories() function last night, and noticed
> > that the hierarchical argument is completely ignored by the function.
> > Doesn't work at all.
> >
> > It seems like I'm not the only one who noticed:
> > http://wordpress.org/support/topic/228280?replies=8
>
> Nathan, could you explain what arguments you're passing to
> get_categories, what results you expect, and what results you're
> getting instead?
>
> I tried get_categories and it seems to be working as expected.  The OP
> on that wp.org support thread states an incorrect description of what
> "hierarchical" means.  What it does mean, when true, is that even when
> "hide_empty" is true the results will include sub-categories that are
> empty but do have child categories that are non-empty.  That is a
> separate issue from the order in which they are returned.
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list