WP_QUERY returns empty set when fired from a WP-CRON scheduled event

Ok I spent an awful amount of time trying to debug this! Searching around I used $wpdb->queries along with define( 'SAVEQUERIES', true ); to debug queries made when wp-cron was running.

then I found out that when cron jobs were running, my query was set to 'post_status' => trash! No wonder I didn’t get any errors and as it turns out, I was trying out a specific query the other day and there was this function still running in my theme functions.php and only affecting non logged in users which was overriding my cron query!

So long story short, nothing to do with wp-cron or wp_query (and even my code), clean up after your tests (I should know better ::facepalm) and make use of debugging tools to help you find the culprit!