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

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 22 14:43:16 UTC 2011


#16829: Automatically set 'compare' => 'IN', when meta value is an array
-------------------------------------+------------------
 Reporter:  scribu                   |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  3.3
Component:  Query                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |
-------------------------------------+------------------
Changes (by duck_):

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


Comment:

 Looks good, but needs a refresh. Would need to move the code defining and
 validating `$meta_compare` to below `$meta_value = $q['value'];` (line
 740).

 Also, does anybody else think it would be a bit more readable if
 `is_array( $meta_value )` sets the default which gets overridden if
 `isset( $q['compare'] )`? For example:

 {{{
 $meta_compare = is_array( $meta_value ) ? 'IN' : '=';
 if ( isset( $q['compare'] ) )
     $meta_compare = strtoupper( $q['compare'] )
 }}}

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


More information about the wp-trac mailing list