[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 21:35:25 UTC 2010


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

  * status:  closed => reopened
  * resolution:  wontfix =>


Comment:

 Ahh yes, I know #9951 - I opened it, and wrote the patch :P

 I agree that meta values will usually be unique - which is why I don't
 want to use a custom taxonomy - also, I can't do comparisons with terms -
 it's just a different concept. I have a meta_key "some_date" which is a
 timestamp, I want to get all dates after a certain timestamp. I am
 currently to that with meta_compare, but if I want to also restrict it by
 another meta_key I can't. I don't see why this would be simply considered
 a progression to the query class - my implementation is about 20 lines of
 code - if that were incorporated into query.php it would be much less.

 > The assumption is that custom field values will be mostly unique. Think
 street addresses. Thus, querying by multiple custom  fields isn't a core
 requirement.

 I don't understand why the above example means you wouldn't want to query
 by more than one meta_key. I.e. get all posts with a street address and a
 country (another meta_key). Especially with all the new added custom post
 type stuff.

 Sorry if I wasn't supposed to re-open the ticket, I don't know if you will
 see the reply if it stays closed.

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


More information about the wp-trac mailing list