[wp-hackers] SQL: pulling WP data by multiple meta_key/value pairs

Simon Blackbourn piemanek at gmail.com
Wed Jan 16 16:33:18 UTC 2013

You can certainly query based on multiple key/values using the meta_query
parameter. [1] & [2]

You may then be able to sort on a third one by passing that in as the
meta_key parameter and setting the orderby parameter to 'meta_value' [3],
although i'm not 100% sure that will work in combination with the
meta_query parameter.

Then you can use the debug bar plugin [4] or any other method of logging
the queries to grab the SQL.


[2] http://scribu.net/wordpress/advanced-metadata-queries.html
[4] http://wordpress.org/extend/plugins/debug-bar/

More information about the wp-hackers mailing list