try with this function
function get_posts_in_taxonomy($post_type, $taxonomy, $term_id, $include_children=false, $limit)
{
$args = [
'post_type' => $post_type,
'posts_per_page' => $limit,
'tax_query' => [
[
'taxonomy' => $taxonomy,
'terms' => $term_id,
'include_children' => $include_children
],
],
// Rest of your arguments
];
$posts = new WP_Query( $args );
if($posts->have_posts()) {
while($posts->have_posts()) {
$posts->the_post();
//code todo here
}
}
} //end func