I need to search property
post types, in a regular WP_Query that is not the main query, but I need to be able to search for a value LIKE
in any of the following meta_queries and also need to search LIKE
in tax_queries, but the comparison between tax_query and meta_query should NOT be an AND
, it needs to be an OR
. How to do this? Here is how my WP_Query args are setup, but it doesn't return any results where it should:
array (
'post_type' => 'property',
'posts_per_page' => 10,
'post_status' => 'publish',
'tax_query' =>
array (
'relation' => 'OR',
0 =>
array (
'taxonomy' => 'type',
'field' => 'name',
'terms' => 'Strip',
),
),
'meta_query' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'city',
'value' => 'Strip',
'compare' => 'LIKE',
),
1 =>
array (
'key' => 'state',
'value' => 'Strip',
'compare' => 'LIKE',
),
2 =>
array (
'key' => 'salelease',
'value' => 'Strip',
'compare' => 'LIKE',
),
3 =>
array (
'key' => 'zip',
'value' => 'Strip',
'compare' => 'LIKE',
),
),
)
Strip
is the search term being sent to the value
. I have a type
with a name of Strip Centers
, but I get empty result here. I think this is using AND to compare the Type with all of the meta_queries also. I just want any value of type OR
any value of the meta_queries.
How to do this properly?