嗨,如何从特定术语中获得子项并排除某些特定条款
我正在努力添加“排除”,以排除以下代码的某些条款。 我找不到编写这样的数组的正确方法。谁能帮我吗?谢谢
<?php
$terms = get_terms( 'product_cat', 'parent=175' );
$count = count($terms);
if ( $count > 0 ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li><a href="'. get_term_link( $term ) .'">'. $term->name . '</a></li>';
}
echo '</ul>';
}
?>
I am struggling to add 'exclude' to exclude some terms for the below code.
I cannot find the correct way to write such an array. Can anyone help me? Thanks
<?php
$terms = get_terms( 'product_cat', 'parent=175' );
$count = count($terms);
if ( $count > 0 ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li><a href="'. get_term_link( $term ) .'">'. $term->name . '</a></li>';
}
echo '</ul>';
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您对
get_terms
的使用不正确。它需要一系列这样的论点:
your usage of
get_terms
is incorrect.it takes an array of arguments like so: