Add custom argument to WP_Query and modify SQL where clause

Solved it. The filter posts_where takes the query object as a second parameter.