[wp-trac] [WordPress Trac] #16829: Automatically set 'compare' => 'IN', when meta value is an array

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 10 22:36:19 UTC 2011


#16829: Automatically set 'compare' => 'IN', when meta value is an array
-------------------------+-----------------------------
 Reporter:  scribu       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+-----------------------------
Description changed by scribu:

Old description:

> {{{
> get_posts( array(
>   'meta_key' => 'foo',
>   'meta_value' => array( 'bar', baz' )
> ) );
> }}}
>
> should just work.
>
> Currently, you have to remember to set meta compare:
>
> {{{
> get_posts( array(
>   'meta_key' => 'foo',
>   'meta_value' => array( 'bar', baz' ),
>   'meta_compare' => 'IN'
> ) );
> }}}
>
> Obviously, it should be the same when using 'meta_query'.

New description:

 This should just work:

 {{{
 get_posts( array(
   'meta_key' => 'foo',
   'meta_value' => array( 'bar', baz' )
 ) );
 }}}

 Currently, you have to remember to set meta compare:

 {{{
 get_posts( array(
   'meta_key' => 'foo',
   'meta_value' => array( 'bar', baz' ),
   'meta_compare' => 'IN'
 ) );
 }}}

 Obviously, it should be the same when using 'meta_query'.

--

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


More information about the wp-trac mailing list