I have a query set up to compare the start and end dates for some custom fields. The start date is required for the post; however, the end date is not. This causes some issues with the following:
query_posts( array ( 'meta_query' => array( array( 'key' => 'start_date', 'value' => $date, 'compare' => '>=', 'type' => 'DATE', ), array( 'key' => 'end_date', 'value' => $enddate, 'compare' => '<=', 'type' => 'DATE', ), ) ) );
This query works fine when the end date has been set on the post; however, when it hasn't, the post will not get queried at all. Is there a way to check first if the field exists first before doing the <= DATE compare?