Ticket #17264: 17264.diff
File 17264.diff, 1.4 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 … … 514 512 if ( ! is_array( $meta_value ) ) 515 513 $meta_value = preg_split( '/[,\s]+/', $meta_value ); 516 514 517 if ( empty( $meta_value ) ) 515 if ( empty( $meta_value ) ) { 518 516 continue; 517 } else { 518 $where[$k] .= ' AND'; 519 } 519 520 } else { 520 521 $meta_value = trim( $meta_value ); 521 522 } … … 532 533 $meta_compare_string = '%s'; 533 534 } 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