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
comment:22 in reply to: ↑ 18 ; follow-up: ↓ 23 scribu — 3 years ago
- Owner set to scribu
- Status changed from reopened to accepted
comment:30 follow-up: ↓ 31 scribu — 3 years ago
- Resolution fixed deleted
- Status changed from closed to reopened