Multiple or relation meta query is not working for more than 2 queries
-
Hello,
Greetings!!I want to use multiple meta query with or relation for more than two conditions like below example:
$query_args['meta_query'] = array( 'relation' => 'OR', array( 'relation' => 'AND', array( 'key' => '_job_tags1', 'value' => $tagId, 'compare' => 'LIKE' ), array( 'key' => '_job_category1', 'value' => $values_serialized, 'compare' => 'LIKE' ) ), array( 'relation' => 'AND', // make sure only this key exists by matching parameters array( 'key' => '_job_tags2', 'value' => $tagId, 'compare' => 'LIKE' ), array( 'key' => '_job_category2', 'value' => $values_serialized, 'compare' => 'LIKE' ) ), array( 'relation' => 'AND', // make sure only this key exists by matching parameters array( 'key' => '_job_tags3', 'value' => $tagId, 'compare' => 'LIKE' ), array( 'key' => '_job_category3', 'value' => $values_serialized, 'compare' => 'LIKE' ) ) );
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button. Failure to do so makes your code unusable for testing, making it less likely for someone to help you.]
this above query is not working for me. Anyone can help me?
Thanks in advance!!
Regards,
Pranjali P.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Multiple or relation meta query is not working for more than 2 queries’ is closed to new replies.