• 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
     );
    
    wp_list_categories($args);

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

    wp_list_categories();

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

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • By adding child_of you are saying only show categories that are a child of category with the ID 5. Is this correct?

    Thread Starter bsytko

    (@bsytko)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘child_of not working with wp_list_categories’ is closed to new replies.