<?php
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'gallery_category',
'field' => 'slug',
'terms' => '5'
)
)
);
$my_query = new WP_Query($args);
while ($my_query->have_posts()) {
$my_query->the_post();
if ( has_post_thumbnail()) {
the_post_thumbnail();
}
}
?>
try this
also do refer here