[wp-trac] [WordPress Trac] #9124: meta_compare needs to allow "in" as well

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 21 17:28:38 UTC 2010


#9124: meta_compare needs to allow "in" as well
-------------------------+--------------------------------------------------
 Reporter:  Otto42       |       Owner:  anonymous                   
     Type:  enhancement  |      Status:  new                         
 Priority:  normal       |   Milestone:  Future Release              
Component:  Query        |     Version:  2.7                         
 Severity:  normal       |    Keywords:  has-patch needs-testing gsoc
-------------------------+--------------------------------------------------

Comment(by aaroncampbell):

 I'd love to see this allow for IN as well as BETWEEN.  The diff I'm
 attaching does just that.  It also allows in or between to be passed in
 any case (between, BETWEEN, BeTwEeN, etc) and uses the WordPress standard
 `preg_split('/[,\s]+/', ...);` to make sure it works as expected.

 Now it also works like this:
 {{{
 get_posts( array( 'meta_key' => '_test', 'meta_value' => '5,8',
 'meta_compare' => 'between') );
 get_posts( array( 'meta_key' => '_test', 'meta_value' => array(5,8),
 'meta_compare' => 'BeTwEeN') );
 }}}

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


More information about the wp-trac mailing list