1

Im using meta query to filter a post loop...

'meta_query'     => array(
        array(
            'key'     => 'some_key',
            'value'   => 'some value here', #single word values work
            'compare' => 'IN'
        )

the loop works if the value is one word, but if it has spaces it doesn't, how can I get this working?

Thank you!

  • That query is going to be super expensive, storing that data in a custom taxonomy would have been thousands of times faster – Tom J Nowell Apr 13 '18 at 1:22
  • There is nothing I can do about that, its part of a plugin we use. – Brooke Apr 13 '18 at 1:38
1

Try to pass your multi value in array, example

'meta_query'     => array(
    array(
        'key'     => 'some_key',
        'value'   => array(
           "value1 with space",
           "value2",
           "value3",
        ),
        'compare' => 'IN'
    )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.