Support » Requests and Feedback » BUG: category with no content but children with content counts as empty

  • If you have a category that in and of itself, has no posts. But has child categories that have posts and you do a wp_list_cats(‘hide_empty=1’).. the parent category gets hidden.

    This seems like a bug to me, as the children have content.

    So forexample if you do something like this;

    wp_list_cats('sort_column=name&hide_empty=0&children='.((isset($_REQUEST['cat']))?$_REQUEST['cat']:'0'));

    Which will display categories, but only the children of the category you’re in.. and you flip hide to 1, suddenly the parent category will be hidden.. this is wrong.

    Thoughts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Posts in a child don’t count as posts in the parent unless the post is in the parent category as well.

    This is not a bug, it’s how the thing is supposed to work. If you want these posts to actually be in the parent category as well, then you have to add them to the parent category explicitly.

    Okay then.. never mind.. =) It just seemed buggy is all.

    Thanks Otto..

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The parent/child relationship of categories can be confusing in some ways. The best way to think about it is that all categories are actually separate. The only thing that the parent/child thing lets you do is to group categories together for display purposes. Posts don’t actually “live” in a category, since they can belong to multiple categories.

    Ah.. valid point.. didn’t think of that..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘BUG: category with no content but children with content counts as empty’ is closed to new replies.