[wp-trac] [WordPress Trac] #23294: Using "OR" in 'meta_query' negates the "NOT EXISTS" compare.
WordPress Trac
noreply at wordpress.org
Fri Jan 25 22:31:33 UTC 2013
#23294: Using "OR" in 'meta_query' negates the "NOT EXISTS" compare.
-----------------------------+--------------------------
Reporter: hereswhatidid | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Query
Version: | Severity: normal
Keywords: |
-----------------------------+--------------------------
When using the "NOT EXISTS" compare within 'meta_query' to look for
undefined custom fields if I also add in a secondary 'OR' query, the
entire query behaves as if I was just checking for "EXISTS". The
following code:
{{{
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'status',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'status',
'value' => 'new',
'compare' => '=',
),
);
}}}
will return any post that has a value set for the "status" custom field.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23294>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list