Pages throwing 404 error on server load

Finally found the problem.

This theme flush the rewrite rules on every request. I have removed the multiple calls to flush_rewrite_rules() and the problem is now gone.

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