文章目录
本文最后更新于 2022-10-14,已超过 365 天未更新,内容可能已失效。
$terms = get_terms($taxonomy,array('parent' => 0));

    if ($terms) {
      foreach($terms as $term) {
        $term_children = get_term_children($term->term_id,$taxonomy);
        if ( count( get_term_children( $term->term_id, $taxonomy ) ) > 0 ) {

            foreach($term_children as $term_child_id) {
                $term_child = get_term_by('id',$term_child_id,$taxonomy);
            
                echo $term_child->slug . '<br>';
                echo $term_child->name . '<br>';
                echo $term_child->description . '<br>';
                
            }

        }
      if (  count( get_term_children( $term->term_id, $taxonomy ) ) === 0 ) {
        echo 'The term has no children to display.';
      }        

         
      }
    } 

 

CC 许可协议
署名-非商业性使用-相同方式共享 4.0 国际 了解协议
文章链接:https://zptheme.com/5061.html
本文作者:子佩·来源:子佩工作室

除非注明,子佩工作室 文章均为原创,转载请以链接形式标明本文地址。

相关推荐

登录后即可发表评论

社交账号登录

全部评论 (0)