Site icon Hip-Hop Website Design and Development

get_terms() delivers incorrect rely with customized taxonomy childs on customized submit kind

I’ve a customized taxonomy lets name it "indications". We use it with a customized submit kind "Product". We use a hierarchy for the phrases Mum or dad->Baby. The Mum or dad has by no means an reference to a product. I take advantage of it to make a customized choose area and would want the dad and mom to be the optgroup header.

Is use this construction
Mum or dad

But when I question for the kid theme and examine the rely it at all times reveals with NULL. Within the WordPress Dashboard it sneakers it appropriately with 2 and 1.

Why not within the entrance finish.

  $args = array(
          'hide_empty' => false, 
          'orderby' => 'title'
  );
      
  $ins = get_terms('indikationen', $args);

if($ins):
    echo "<select>";
    foreach($ins as $in):

      
        if ( rely( get_term_children( $in->term_id, 'indikationen' ) ) > 0 ):
        echo '<optgroup label="'.$in->name.'">';
          foreach($ins as $sub):
            if($sub->guardian == $in->term_id):
                echo "<option value='".$sub->term_id."'>".$sub->title. " count: ".$sub->rely."</option>";
          // SUB-COUNT is at all times NULL however has right rely in backend
            
            endif;
          endforeach;
        echo '</optgroup>';
        
        else:
          if($in->rely):
            echo "<option value='".$in->term_id."'>" .$in->title. " (".$in->rely.")</option>";
          endif;
        endif;  
    
    endforeach;
    echo "</select>";
  endif;


What am I doing incorrect?

var_dump($sub);
// reveals me for rely additionally NULL

Thanks