[wp-trac] [WordPress Trac] #14645: Support for multiple meta_key => meta_value pairs in WP_Query

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 19 14:43:06 UTC 2010


#14645: Support for multiple meta_key => meta_value pairs in WP_Query
-------------------------+--------------------------------------------------
 Reporter:  joehoyle     |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:                 
 Severity:  normal       |    Keywords:                 
-------------------------+--------------------------------------------------
 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?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14645>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list