• Hi, I really hope someone can help me. I’m using wp_list_categories to, well, list some categories in my footer. The arguments for ‘include’ and ‘depth’ work independently of one another but now when used together:

    <?php wp_list_categories(‘title_li=&include=3,773,789,849,882&depth=0’); ?>

    I just get the top level as if I specified ‘depth=1’, same if I up the depth to 2 or 3. Can these not be used in conjunction? Any ideas very welcome.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The include argument is basically a white-list. The output of wp_list_categories() will include only the Pages you list with the include argument, regardless of your depth argument.

    Perhaps try using exclude to exclude the Pages you don’t want, instead of using include to include the Pages you do want?

    Note, you could also use exclude_tree, though, last I checked, its behavior could be a bit… non-intuitive.

    Thread Starter Nugerama

    (@nugerama)

    Brilliant! So so much for the speedy reply chip – seems so obvious now you’ve pointed it out!

    I’ve opted to exclude rather than include and it’s working a treat. Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble with depth using wp_list_categories’ is closed to new replies.