admin管理员组文章数量:1312858
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.
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.
1 Answer
Reset to default 0You'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.
本文标签: categoriesHow to get immediate children of a 39term39 parent id through 39getterms39
版权声明:本文标题:categories - How to get immediate children of a 'term' parent id through 'get_terms'? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741895853a2403570.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论