How to short circuit a wordpress query that is not related to posts?

How to short circuit a wordpress query that is not related to posts?

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