[wp-hackers] meta_query with same key twice

Robert Lusby nanogwp at gmail.com
Mon Jan 16 17:04:50 UTC 2012


On 16/01/2012 16:43, Otto wrote:
> On Mon, Jan 16, 2012 at 10:28 AM, Robert Lusby<nanogwp at gmail.com>  wrote:
>> Hello,
>>
>> Found another "feature" of WP - meta_query doesn't work if you set the same
>> keyname twice and a relation of "OR"?
>>
>> Is this correct? Or is my query off?
>>
>> 'meta_query' =>  array(
>>                 'relation' =>  'OR',
>>                 array(
>>                     'key' =>  'keyname',
>>                     'value' =>  'test',
>>                     'compare' =>  '='
>>                 ),
>>                 array(
>>                     'key' =>  'keyname',
>>                     'value' =>  'somethingelse',
>>                     'compare' =>  '='
>>                 ),
>>             )
> Use an IN compare instead.
>
> 'meta_query' =>  array(
>                 array(
>                     'key' =>  'keyname',
>                     'value' =>  array('test','somethingelse')
>                     'compare' =>  'IN'
>                 )
>             )
>
>
> -Otto

Otto - you are a star! Where can I send the beer?

Rob




More information about the wp-hackers mailing list