[wp-trac] [WordPress Trac] #18158: Meta Query for posts with a meta key not set (IS NULL).
WordPress Trac
wp-trac at lists.automattic.com
Wed Aug 22 19:18:37 UTC 2012
#18158: Meta Query for posts with a meta key not set (IS NULL).
-----------------------------------------------+---------------------------
Reporter: johnnyb | Owner:
Type: enhancement | georgestephanis
Priority: normal | Status: closed
Component: Query | Milestone: 3.5
Severity: normal | Version: 3.2.1
Keywords: has-patch needs-unit-tests commit | Resolution: fixed
-----------------------------------------------+---------------------------
Comment (by WraithKenny):
Does this make it possible to orderby a meta_value and not exclude records
lacking the meta?
I've tried a bunch of things, including:
{{{
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'geo_public',
),
array(
'key' => 'geo_public',
'compare' => 'NOT EXISTS',
),
),
}}}
but it seems the first trumps the 2nd. It does work if by itself.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18158#comment:45>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list