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

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 3 17:50:58 UTC 2010


#9124: meta_compare needs to allow "in" as well
-------------------------+--------------------------------------------------
 Reporter:  Otto42       |       Owner:  anonymous     
     Type:  enhancement  |      Status:  new           
 Priority:  normal       |   Milestone:  3.1           
Component:  Query        |     Version:  2.7           
 Severity:  normal       |    Keywords:  has-patch gsoc
-------------------------+--------------------------------------------------
Changes (by aaroncampbell):

  * keywords:  needs-refresh gsoc => has-patch gsoc


Comment:

 I refreshed the patch.  Please also see #14645.  You can now use 'like',
 'in', or 'between' as well as all the previously allowed operators.

 I don't think this really needs the gsoc tag.

 I tested it like this, and it works:
 {{{

     query_posts( array(
         'post_type'             => 'beer', // Show posts from the beer
 post type
         'paged'                 => $paged,
                 'meta_query'    => array(
                         array(
                                 'meta_key'              => '_abv',
                                 'meta_compare'  => 'BeTwEeN',
                                 'meta_value'    => array(6,8)
                         ),
                         array(
                                 'meta_key'              => '_ibu',
                                 'meta_compare'  => '>',
                                 'meta_value'    => 50
                         ),
                 )
     ) );
 }}}

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


More information about the wp-trac mailing list