I need to query posts by two meta fields and the wo_query I'm doing it with is returning nothing. Obviously, it's broken. Can somebody tell me what I'm doing wrong?
$args = array( 'post_type' => 'espresso_event', 'post_status' => 'publish', 'posts_per_page' => 8, 'category_name' => 'homepage', 'meta_query' => array( array( 'key' => 'event_start_date', 'value' => date('Y-m-d'), 'compare' => '>=', 'type' => 'DATE' ), array( 'key' => 'event_end_time', 'value' => date('g:i A'), 'compare' => '>=', 'type' => 'TIME' ) ), 'orderby' => 'meta_value', 'order' => 'ASC' // change this to ASC if you want newer events on top ); // this saves the query to a temporary location so we can go back to it later after we run our query $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query($args);
The query works without this part:
array( 'key' => 'event_end_time', 'value' => date('g:i A'), 'compare' => '>=', 'type' => 'TIME' )
So obviously the problem is there but I don't get an error or anything so I can't see what the problem is.