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

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 13 16:36:11 GMT 2009

#9124: meta_compare needs to allow "in" as well
 Reporter:  Otto42       |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.8      
Component:  General      |     Version:  2.7      
 Severity:  normal       |    Keywords:           
 In wp-includes/query.php:

 if ( ! empty($q['meta_value']) ) {
 if ( ! isset($q['meta_compare']) || empty($q['meta_compare']) || !
 in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=')) )
 $q['meta_compare'] = '=';

 This bit of code basically allows one to specify a meta_compare, in order
 to allow the meta_value to be something other than equal only. Greater
 than, less than, etc. However, it could be nice if it would also allow the
 word "in" to be used as it is used in SQL, thus resulting in a statement
 like this:


 ... AND meta_value in (1,2,3) ...

 The "in" case would need to be added to that array, and special handling
 would be needed to add the parenths around the values in that case.

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

More information about the wp-trac mailing list