where to add this filter? in which file should be added?

Add this code to your functions.php file in your WordPress theme files.

See this article for some additional help:
https://www.rosehosting.com/blog/how-to-add-code-to-functions-php-in-wordpress/

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