Display only post types that are direct children of the current taxonomy

Did you try WP_Query? Using my knowledge and the WP_Query documentation, I did this:

$args = array(
    'post_type' => 'my_post_type', //change the post type here
    'post_status' => 'publish',
    'tax_query' => array(
        array(
            'taxonomy' => 'my_category', //change the taxonomy name here
            'field' => 'id',
            'include_children' => false,
            'terms' => 10 //change the term id here 
        )
    )
);
$_query = new WP_Query($args);

if ($_query->have_posts()):
    while ($_query->have_posts()):
        $_query->the_post();
        
        //do something here the_title() etc
    endwhile;
endif;

wp_reset_query();

The magic should come from the include_children attribute. Test it out 🙂

Is this what you wanted?