Function get_tag
retrieves post tag by tag ID or tag object.
This tags object is not connected with your current post.
Use get_the_tags
to retrive tags of a current post in the loop
$post_tags = get_the_tags();
if ( $post_tags ) {
echo $post_tags[0]->name;
}
Add post id to get_the_tags
function to retrieve tags of this post without loop
$post_tags = get_the_tags('YOUR POST ID');
if ( $post_tags ) {
echo $post_tags[0]->name;
}
Check if category exists in array of included tags using in_array
//outside the loop
$date_tags = array(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58);
//inside the loop
//shows only first tag name if it finds one or more
$post_tags = get_the_tags();
if ( $post_tags && in_array($post_tags[0]->term_id, $date_tags ) ) {
echo $post_tags[0]->name;
}