wp query sort by meta date

Solutions on MaxInterview for wp query sort by meta date by the best coders in the world

showing results for - "wp query sort by meta date"
Maximilian
07 Jan 2020
1$args = array(
2    'numberposts' => 2,
3    'meta_query' => array(
4        array(
5            'key' => 'event_date', // I've set this variable according to your examples
6            'value' => date("Y-m-d"),
7            'type' => 'DATE',
8            'compare' => '>=' // Or > if strictly bigger dates are required
9        )
10    )
11);
12
13// get results
14$the_query = new WP_Query( $args );
15