Meta query compare LIKE not working
-
Hello!
In my page I have got a serach form to filter by weekday, state and address. In results I can filterby weekday and state but not by address.
I did this query:$argsy = array (
‘post_type’ => ‘market’
‘orderby’=> ‘title’,
‘order’ => ‘ASC’,
‘posts_per_page’ => -1,
‘post_status’ => ‘publish’,
‘meta_query’ => array(
‘relation’ => ‘AND’,
array(‘key’ => ‘market_state’,’compare’ => ‘=’,’value’ => $chooseregion),
array(
‘relation’ => ‘OR’,
array(‘key’ => ‘market_city’,’compare’ => ‘LIKE’,’value’ => stripslashes_deep($choosecity)),
array(‘key’ => ‘market_address’,’compare’ => ‘LIKE’,’value’ => stripslashes_deep($choosecity))
)
)
);Variable are stored by $_REQUEST.
Like comparison doesn’t work in any case, I’ve been trying with IN:
array(‘key’ => ‘market_address’,’compare’ => ‘IN’,’value’ => explode(“+”, $choosecity)),but it doesn’t work if I search for a single word.
With = comparison I can only get the matching results but I cannot display markets with address which contains that word.
Can you help me please?
- The topic ‘Meta query compare LIKE not working’ is closed to new replies.