WordPress: wp_list_categories- depth of hierarchy

Posted by

WordPress: wp_list_categories- depth of hierarchy

You can use the following tag to display the categories in your theme:

wp_list_categories( $args );

We will discuss the various arguments one by one in each post:

(integer) This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories. The default value is 0 (display all Categories and their children). This parameter added at Version 2.5
0 – All Categories and child Categories (Default).
-1 – All Categories displayed in flat (no indent) form (overrides hierarchical).
1 – Show only top level Categories
n – Value of n (some number) specifies the depth (or level) to descend in displaying Categories

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.