I know how to list all subcategories from a certain category, but don't know how to list all subcategories from all categories.
For example, here is category:
Category 1
-Child Category1
-Child Category2
Category 2
-Child Category3
-Child Category4
Category 3
-Child Category5
-Child Category6
The list i want is :
-Child Category1
-Child Category2
-Child Category3
-Child Category4
-Child Category5
-Child Category6
This is code i have now
<?php wp_list_categories( array(
'orderby'=> 'id',
'order' => 'DESC',
'show_count' => false,
'use_desc_for_title' => false,
'title_li' => '',
) ); ?>
I know how to list all subcategories from a certain category, but don't know how to list all subcategories from all categories.
For example, here is category:
Category 1
-Child Category1
-Child Category2
Category 2
-Child Category3
-Child Category4
Category 3
-Child Category5
-Child Category6
The list i want is :
-Child Category1
-Child Category2
-Child Category3
-Child Category4
-Child Category5
-Child Category6
This is code i have now
<?php wp_list_categories( array(
'orderby'=> 'id',
'order' => 'DESC',
'show_count' => false,
'use_desc_for_title' => false,
'title_li' => '',
) ); ?>
Share
Improve this question
asked May 18, 2020 at 12:48
user18787user18787
33 bronze badges
1 Answer
Reset to default 0Well, according to official documentation, you should pass depth argument inside your function.
As it's written here
Try this:
<?php wp_list_categories( array(
'orderby'=> 'id',
'order' => 'DESC',
'show_count' => false,
'use_desc_for_title' => false,
'title_li' => '',
'depth; => 1
) ); ?>