Tag Posts showing in wrong places

Ok so I sorted the issue for now by using –

$queried_object = get_queried_object();
$term_id = $queried_object->term_id;

instead of –

$tags = wp_get_post_tags($post->ID);
$first_tag = $tags[0]->term_id;

Any comments?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)