[wp-hackers] meta_query with same key twice
Otto
otto at ottodestruct.com
Mon Jan 16 16:43:46 UTC 2012
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
More information about the wp-hackers
mailing list