0

I have a category orientation as:

Series (ID: 15) (root category)

Under 'Series', the following sub-categories are present:

  • Series A (Contains 0 posts)
  • Series B (Contains 1 post)
  • Series C (Contains 0 posts)

How can I get the all three subcategories under the 'Series' category using 'get_terms'?

I have used the following parameter structure sent as $args (term query) to 'get_terms' with no result. It returns an empty array:

$arg['taxonomy'] = 'category';
$arg['hide_empty'] = 0;
$arg['parent'] = 15;
$arg['number'] => 0;
$arg['orderby'] = 'term_id';
$arg['order'] = 'ASC';

What am i doing wrong?

Please note that I want to achieve this through 'get_terms' only so that I can use the same for other custom terms too.

0

1 Answer 1

0

You've set number to 0, so it will do as told and return 0 terms. Remove the number argument if you want all matching terms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.