Display category in tree format

I have setup category in the structure below

– A (parent)
– B (child of A)
– C (child of B)
– X (parent)
– Y (child of X)
– Z (child of Y)

and I need to display it in the same tree structure in my page.

I have tried wp_list_categories() However, its not displaying it in the structure above.

$args = array(
‘hide_empty’ => 0,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘show_count’ => 0,
‘use_desc_for_title’ => 0,
‘echo’ => false,
$categories = wp_list_categories($args);

Any suggestions ?

Read more here:: Display category in tree format

Leave a Reply

Your email address will not be published. Required fields are marked *