Insert Tag in WordPress Post

If you are using wp_set_post_tags this you can pass either
array of exiting tags id or array of string.

If it is a string then it will create a new one and assign that, if you are passing an id then it will assign that term_id of post_tag.

As per your code I can see you are passing tag’s slug and this is being treated as a string and that is why it is creating the tag again.

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