admin管理员组文章数量:1026989
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
2 Answers
Reset to default 0Try relying on the new WP_Term_Query() class, here's an example per your code:
// WP_Term_Query arguments
$args = array(
'taxonomy' => 'carabana_Cat',
'hide_empty' => false,
'orderby' => 'description',
'child_of' => 28)
);
// The Term Query
$term_query = new WP_Term_Query( $args );
Taxonomy names are case–sensitive:
d( taxonomy_exists( 'post_tag' ) ); // true
d( taxonomy_exists( 'post_Tag' ) ); // false
You seem to have mismatch between taxonomy name and your code.
PS also orderly
reather than orderby
typo.
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
2 Answers
Reset to default 0Try relying on the new WP_Term_Query() class, here's an example per your code:
// WP_Term_Query arguments
$args = array(
'taxonomy' => 'carabana_Cat',
'hide_empty' => false,
'orderby' => 'description',
'child_of' => 28)
);
// The Term Query
$term_query = new WP_Term_Query( $args );
Taxonomy names are case–sensitive:
d( taxonomy_exists( 'post_tag' ) ); // true
d( taxonomy_exists( 'post_Tag' ) ); // false
You seem to have mismatch between taxonomy name and your code.
PS also orderly
reather than orderby
typo.
本文标签: Unable to retrieve any child terms using getterms
版权声明:本文标题:Unable to retrieve any child terms using get_terms 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745668447a2162313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论