child_of not working with wp_list_categories (3 posts)

  1. bsytko
    Posted 4 years ago #

    Hi all,

    I have a list of categories that includes several sub-categories in the tree. When I use the wp_list_categories function to print these out, this works perfectly. However, when I add the child_of paramter and pass it a number of the category it just returns 'No categories.'

    $args = array(
         'child_of' => 5,
         'hide_empty' => 0

    This returns 'No categories'. But, if I just do:


    with no arguments, it prints out the tree correctly! Anyone know what I'm doing wrong?


  2. equalmark
    Posted 4 years ago #

    By adding child_of you are saying only show categories that are a child of category with the ID 5. Is this correct?

  3. bsytko
    Posted 4 years ago #

    Yep, I want to show all sub categories of catId=5. They show up fine when I just use the command without any arguments but not when I try to specifically nail it down to 1 category.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.