0

My query is currently sorting by end date. How can I make it so it will sort by the start date?

$args = array ('post_type'      => 'events',
           'meta_query'     => array(
                array(
                   'key'        => 'start_date',
                   'value'      => $min_date,
                   'compare'    => '>'
                ),
                array(
                   'key'        => 'start_date',
                   'value'      => $max_date,
                   'compare'    => '<'
                ),
                array(
                   'key'        => 'end_date',
                   'value'      => $current_date,
                   'compare'    => '>'
                )
            ),
           'orderby'        => 'meta_value',
           'order'          => 'ASC'
          );
0

1 Answer 1

1

try adding:

'meta_key' => 'start_date'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.