for those who failed to filter by categories... i found slight bug in the query..
on line 259, change:
"WHERE x.taxonomy = 'category' AND t.term_id IN ($res_cat)"
"WHERE x.taxonomy = 'category' AND x.term_taxonomy_id IN ($res_cat)"
This solves my problem, and hope yours too