How to have several arguments in WP_QUERY Meta_Query
-
I would like to know what is the best way to use multiple argument in a WP_QUERY.
I would like to display post Where (“rel_equip_visitor” or “rel_equip_host” LIKE $equipeid), AND (Data_match >= $today).
Problem i have is do not know how to use (if it’s possible) 2 arguments (AND and OR) in the same query, like we do in MySql.
I have try severals thinks to get different type of results, but never the good one. I made some search, but it’s seem not be possible. Is there is a way to make it working ?
$args = array( 'post_type' => 'matchs', 'post_status' => 'publish', 'paged' => $paged, 'meta_query' => array( 'relation' => 'OR', array('key' => 'rel_equip_visitor', 'value' => $equipeid), array('key' => 'rel_equip_host', 'value' => $equipeid), ), array('relation' => 'AND', 'meta_key' => 'date_match','meta_compare' => '>=','meta_value' => $today) ); // The Query $query_matchs = new WP_Query( $args );
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to have several arguments in WP_QUERY Meta_Query’ is closed to new replies.