Where to add_filter in theme functions.php?

Usually, it would be the best to add at the bottom of the script, to make sure everything you use inside the snipped is declared already and ready to use.
It all depends on the actual code you’re using and your goal.

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