[wp-hackers] WP_Query() for meta_value = Empty or Missing?

Dan Smart dan at dansmart.co.uk
Thu Sep 16 06:44:49 UTC 2010


I had the same issue just the other day also, and would +1 any query for
'empty' or similar.

I ended up doing two queries - one for those with the meta_value, and then
doing a second with 'post__not_in' for the ids. It worked for me because I
needed to display those with the meta_value separately, so it wasn't a lost
query.

----------------------------------------------------------------------------
---------
Dan Smart - Freelance Web Developer
Web: www.dansmart.co.uk
Tel: +447931588361
Follow me at: www.twitter.com/danielsmart

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Mike Schinkel
Sent: 16 September 2010 05:48
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] WP_Query() for meta_value = Empty or Missing?

On Sep 16, 2010, at 12:35 AM, Andrew Nacin wrote:
> On Wed, Sep 15, 2010 at 11:21 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
>> Why not just use wpdb.
> 
> Mike, looks like you're going to have to use said hooks. I was doing the
> same thing the other day (and ended up with a different implementation,
but
> I saw the route I needed to take for that).

Thanks for confirming.  Any chance of a near term addition for this kind of
thing?  
Could we add options for 'null', 'empty' and 'nullorempty' to meta_compare?

-Mike

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list