Ticket #9124: 9124.3.diff
File 9124.3.diff, 1.3 KB (added by , 14 years ago) |
---|
-
wp-includes/query.php
2305 2305 if ( ! empty($q['meta_key']) ) 2306 2306 $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']); 2307 2307 if ( ! empty($q['meta_value']) ) { 2308 if ( empty($q['meta_compare']) || ! in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=' )) )2308 if ( empty($q['meta_compare']) || ! in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=', 'in')) ) 2309 2309 $q['meta_compare'] = '='; 2310 2311 $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']); 2310 2311 if ( 'in' == $q['meta_compare'] ) { 2312 if ( !is_array($q['meta_value']) ) 2313 $q['meta_value'] = preg_split('!,\[\r\n\t ]+!', $q['meta_value']); 2314 $meta_field_types = substr(str_repeat(',%s', count($q['meta_value'])), 1); 2315 $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value IN($meta_field_types) ", $q['meta_value']); 2316 unset($meta_field_types); 2317 } 2318 else 2319 $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']); 2312 2320 } 2313 2321 2314 2322 // Apply filters on where and join prior to paging so that any