Support for multiple meta_key => meta_value pairs in WP_Query
|Reported by:||joehoyle||Owned by:||scribu|
Currently you cant query for multiple meta_key -> meta_value pairs in WP_Query, it ouwl d good if I could say: get me posts with meta_key 'time' = 'today' AND meta_key 'event' = 'show'. Typically specifying meta_keys and values as arrays:
$queyr = new WP_Query( array( 'meta_key' = array( 'time', 'event' ), 'meta_value' = array( 'today', 'show' ), meta_compare = array( '=', '=' ) ) );
Alternatively it could use an associative array, but you would still need a second array to specify different meta_compare's.
I have implemented this via hooks in my function helper framwork - but thought it would be a solid addition to WP_Query. Thoughts?
Change History (38)
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
- Owner set to scribu
- Status changed from reopened to accepted
- Resolution fixed deleted
- Status changed from closed to reopened