Created a custom post type `Menu` it has `Categories` and `Sub-Categories`.

I am succeeded in fetching Sub-Categories of the post using this code.

    <?php
        $wcatTerms = get_terms('menu-items', array('hide_empty' => 0, 'orderby' => 'ASC',  'parent' =>0));
        foreach($wcatTerms as $wcatTerm) : 
            //echo $wcatTerm->name;
            $wsubargs = array('hierarchical'=>1,'show_option_none'=>'','hide_empty'=>0,'parent'=>$wcatTerm->term_id,'taxonomy'=>'menu-items');
            $wsubcats = get_categories($wsubargs);
            foreach ($wsubcats as $wsc):
               $childcat = $wsc->name; ?>
                <h2><?php echo $childcat; ?></h2>
         
            endforeach;
        endforeach; 



Later as per my requirement I want to displayed post based in `sub-category` for that I used this `query`

    <?php 
            $posts = get_posts(array(
                  'post_type' => 'menu',
                  'orderby' => 'name',
                  'order' =>  'DESC',
                  'taxonomy' => $wcatTerm->taxonomy,
                  'term'  => $wcatTerm->slug,
                  'category' => '$childcat',
                  'nopaging' => true,
                  ));
                  foreach($posts as $post) {
    				  //echo $wsc->name;
                  setup_postdata($post); ////set up post data for use in the loop (enables the_title(), etc without specifying a post ID--as referenced in the stackoverflow link above)
                ?>

But What I am getting was Categories being listed as they should but **ALL** the posts are being repeated for every sub-category. 

As you can see in query I already added `'category' => '$childcat',` but still i am not getting filter applied,Please someone help me on getting this.


Complete Code


    <?php
    $wcatTerms = get_terms('menu-items', array('hide_empty' => 0, 'orderby' => 'ASC',  'parent' =>0));
    foreach($wcatTerms as $wcatTerm) : 
        //echo $wcatTerm->name;
        $wsubargs = array('hierarchical'=>1,'show_option_none'=>'','hide_empty'=>0,'parent'=>$wcatTerm->term_id,'taxonomy'=>'menu-items');
        $wsubcats = get_categories($wsubargs);
        foreach ($wsubcats as $wsc):
            ?><h2><?php //echo $wsc->name; ?></h2>
            <?php $childcat = $wsc->name; 
    				$childid = $wsc->ID;
            ?>
            <h2><?php echo $childcat; ?></h2>
            <?php 
            $posts = get_posts(array(
          'post_type' => 'menu',
          'orderby' => 'name',
          'order' =>  'DESC',
          
          'tax_query' => array(
              array(
                  'taxonomy' => $wsc->taxonomy,
                  'term'  => $wsc->term_id,
                  'include_children' => false,
              )
          ),
          'nopaging' => true,
          ));?>
                             <div class="menu-title"><?php the_title(); ?></div>
                             <div class="menu-title"><?php the_content(); ?></div>
                            <?php //endwhile; ?>
                <?php
            
        endforeach;
    endforeach; 
    ?>