[wp-hackers] Sorting Posts By Custom Meta Value

scribu scribu at gmail.com
Thu Jul 23 21:35:00 UTC 2009


>
> What's the best way to grab the posts without a value set in that meta_key
> and add them to the end of the post array without actually setting that
> value in the database?
>

You could make the select look like this:

SELECT ..., IFNULL(meta_value, 0) ...

This will replace null values with 0.


-- 
http://scribu.net


More information about the wp-hackers mailing list