Ticket #17264: 17264.2.diff
File 17264.2.diff, 1.2 KB (added by , 13 years ago) |
---|
-
wp-includes/meta.php
492 492 elseif ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED' ) ) ) 493 493 $meta_type = 'CHAR'; 494 494 495 if ( empty( $meta_key ) && empty( $meta_value ) )496 continue;497 498 495 $alias = $i ? 'mt' . $i : $meta_table; 499 496 500 497 $join .= "\nINNER JOIN $meta_table"; … … 503 500 504 501 $i++; 505 502 503 $where[$k] = ''; 506 504 if ( !empty( $meta_key ) ) 507 505 $where[$k] = $wpdb->prepare( "$alias.meta_key = %s", $meta_key ); 508 506 … … 531 529 } else { 532 530 $meta_compare_string = '%s'; 533 531 } 532 533 if ( $where[$k] ) 534 $where[$k] .= ' AND'; 534 535 535 $where[$k] = ' (' . $where[$k] . $wpdb->prepare( " ANDCAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})", $meta_value );536 $where[$k] = ' (' . $where[$k] . $wpdb->prepare( " CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})", $meta_value ); 536 537 } 537 538 $where = ' AND (' . implode( " {$this->relation} ", $where ) . ' )'; 538 539