get_the_category() always returns empty array

Your code will run when the plugin is first initiated, which will be before the post data has been set up. Move all of your code from $cat = get_the_category($id); up to (but not including) add_filter... inside the function.

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