$term = get_queried_object();
$term_slug = $term->slug;
$_posts = get_posts( array(
'post_type' => 'works',
'posts_per_page' => 100,
'tax_query' => array(
array(
'taxonomy' => 'works-cat',
'field' => 'slug',
'terms' => $term_slug,
),
),
));
foreach ($_posts as $post) : setup_postdata($post);
get_template_part( 'works-item' );
endforeach;
wp_reset_postdata();
выводится очень много постов, даже больше чем есть в базе