#23294 closed defect (bug) (duplicate)
Using "OR" in 'meta_query' negates the "NOT EXISTS" compare.
| Reported by: | hereswhatidid | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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.
Change History (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #23268.