Support » Fixing WordPress » wp_list_categories ignoring the “child_of” flag?

  • On my homepage I am trying to get the categories list to be shorter than it is. I am doing this by trying to only show ONE level of children.

    “Dev Diary” is a child of 0.
    “” is a child of “Dev Diary”
    “JS/CSS Etc” is a child of “” and I don’t want it listed there and it shouldn’t be listed there as I have the child_of flag set to zero..


    Is there a better way to do this? I previously had written my own plugin to get around this with 2.04 and had hoped this would be resolved now, but still doesn’t appear to be fixed..

Viewing 7 replies - 1 through 7 (of 7 total)
  • Actually, if you have the child_of parameter set to 0 (zero) then the template tag, wp_list_categories(), wouldn’t even show the Category.

    Unfortunately there is no “depth” parameter like wp_list_pages offers, so you may have to resort to just using the include= parameter.

    Please note, I should encourage you to upgrade to at least version 2.0.11 of WordPress for security reasons.

    I’m up to 2.32 now.. and this is what I’m using;


    All children are being shown. Thoughts?

    Can we get Custom Fields with categories then so we can have some manipulation control similar to what we do with Pages?

    child_of is NOT for excluding anything.
    With that parameter you can configure only to show children of X category. That’s it. It does NOT work as an exclusion tool.

    See the Codex:

    (integer) Only display categories that are children of the category identified by this parameter. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false.


    Fine, then that means there is no way to set a depth, or to easily exclude stuff..

    (sorry but having to add to an exclusion list in the file each time I create a sub/sub category isn’t acceptable)

    Is there a way for us to get custom fields with categories?

    Custom fields are post oriented. Each post can have one or more custom fields assigned.

    This article in Codex, Displaying_Posts_Using_a_Custom_Select_Query, might give you some ideas.

    Okay thats fine, but that doesn’t solve the issue.

    The issue here is, there is no way to easily exclude child categories from being displayed..

    There either needs to be a way to specify “depth” in the wp_list_categories function or add custom words to categories so the same custom select system can be applied to categories.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_list_categories ignoring the “child_of” flag?’ is closed to new replies.