Support

Account

Home Forums General Issues wp_query how to order events by date then time Reply To: wp_query how to order events by date then time

  • I can see in a forum post below that using clauses might be the way forward but as you can see from the below example

    'meta_query' => array(
    	'relation' => 'AND',
        'date_clause' => array(
            'key' => 'event_date',
    		'compare'	=> '=',
        ),
        'time_clause' => array(
            'key' => 'event_time',
    		'compare'	=> '=',
        ),
    ),
    'orderby' => array(
    	'date_clause' => 'ASC',
    	'time_clause' => 'ASC',
    ),
    

    Which I’ve borrowed from that post is that my needs include an OR relation for start and end date (end date like start and end time are also optional) so can a clause include an OR relation inside of it or is there a different way to solve this?