WP query is calling get_userdata and throws error [closed]

You need to call that code from within a hook. Calling it directly inside your plugin is way too soon – get_userdata is a pluggable function and will not yet be loaded.

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