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

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 20 16:59:42 UTC 2010


#14645: Support for multiple meta_key => meta_value pairs in WP_Query
-------------------------+--------------------------------------------------
 Reporter:  joehoyle     |        Owner:                 
     Type:  enhancement  |       Status:  reopened       
 Priority:  normal       |    Milestone:  Awaiting Review
Component:  Query        |      Version:                 
 Severity:  normal       |   Resolution:                 
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by scribu):

 You make a new JOIN for each pair; that doesn't scale well. In my plugin I
 do something like this:

 {{{
 WHERE CASE meta_key
   WHEN 'address' THEN meta_value = 'London'
   WHEN 'rating' THEN meta_value < 5
 END
 GROUP BY post_id HAVING COUNT(*) = 2
 }}}

 Anyway, before we continue, this patch should get a blessing (or a
 wontfix) from the core devs.

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


More information about the wp-trac mailing list