<?php
$custom_query = new WP_Query( "posts_per_page=-1&category_name=$cat_name" );
if ( $custom_query->have_posts() ) :
while ( $custom_query->have_posts() ) : $custom_query->the_post();
$posttags = get_the_tags();
if ( $posttags ):
foreach( $posttags as $tag ):
$all_tags[] = $tag->term_id;
endforeach;
endif;
endwhile;
endif;
$tags = array_unique($all_tags);
foreach ( $tags as $tag ):
$t = get_tag($tag);
?>
<li class="tab--page__item">
<a class="tab--page__link" data-tag="<?= $t->slug ?>"><?= $t->name ?></a>
</li>
<?php endforeach; wp_reset_postdata(); ?>