How to detect if query is runned from widget?

You could use the is_main_query Function :

http://codex.wordpress.org/Function_Reference/is_main_query

Happy Coding, Kuchenundkakao

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