I have custom Field named “motor_brand” of posts.This meta values saved as ["honda","suzuki","kawasaki","toyota"]
If i search just honda by meta_query then all pos having honda meta value if iwant to search honda and kawasaki then the having honda or kawasaki meta values appear if i want to search kawasaki,honda and toyota then posts that having meta value honda, kawasaki or toyota can be appers.
I have set meta query like this
meta_ query = array(
'relation'=>'OR'
array(
meta_key =>'motor_brand'
value => "honda",
compare => "LIKE"
),
array(
meta_key =>'motor_brand'
value => "kawasaki",
compare => "LIKE"
),
)
That works fine but when i try
meta_ query = array(
'relation'=>'OR'
array(
meta_key =>'motor_brand'
value => "honda",
compare => "LIKE"
),
array(
meta_key =>'motor_brand'
value => "kawasaki",
compare => "LIKE"
),
array(
meta_key =>'motor_brand'
value => "toyota",
compare => "LIKE"
),
)
That not work
i want to search to many motor brands
Maybe you want to try this:
It should produce
WHERE motor_brand IN ('honda','kawasaki','toyota')
and should show you results if you execute on your db directly.Edit
Oh sorry, i saw you wrote
The
IN
doesnt work if you stored it like this. But what aboutmotor_name
. Your Field is namedmotor_name
but your query asks formotor_brand
.