wordpress meta query relation

Solutions on MaxInterview for wordpress meta query relation by the best coders in the world

showing results for - "wordpress meta query relation"
Veronica
14 Jul 2016
1$results = query_posts( array(
2    'post_type' => 'event_id',
3    'meta_query' => array(
4        'relation' => 'AND',
5        array(
6            'relation' => 'OR',
7            array(
8                'key' => 'primary_user_id',
9                'value' => $user_id
10            ),
11            array(
12                'key' => 'secondary_user_id',
13                'value' => $user_id
14            )
15        ),
16        array(
17            'key' => 'date',
18            'value' => array( $start_date, $end_date ),
19            'type' => 'DATETIME',
20            'compare' => 'BETWEEN'
21        )
22    )
23) );