0
votes

I want to display categories with nested subcategories of specific parent that I know the id of. I want to use wp_list_categories function. Here is my code:

            $args = array(
               'taxonomy'     => 'product_cat',
               'orderby'      => 'name',
               'show_count'   => 0,
               'hierarchical' => 1,
               'title_li'     => '',
               'hide_empty'   => 0,
               'parent'     => 20

        );
            wp_list_categories($args);

Categories of parent with the id of 20 are displaying correctly, but their children(subcategories) are not showing. What can be the solution here?

1

1 Answers

0
votes

change: 'parent' => 20 to 'child_of' => 20