Ticket #18158: 18158.2.diff
File 18158.2.diff, 910 bytes (added by , 13 years ago) |
---|
-
wp-includes/meta.php
724 724 $join[$i] .= $i ? " AS $alias" : ''; 725 725 $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column)"; 726 726 727 if( in_array( strtoupper( $q['compare'] ), array( 'EXISTS', 'NOT EXISTS' ) ) ) { 728 $join[$i] = "LEFT JOIN $meta_table"; 729 $join[$i] .= $i ? " AS $alias" : ''; 730 $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column AND $alias.meta_key = '$meta_key')"; 731 732 $where[$k] = ' ' . $alias . '.' . $meta_id_column . ' IS ' . ( ( strtoupper( $q['compare'] ) == 'EXISTS' ) ? 'NOT' : '' ) . ' NULL '; 733 734 continue; 735 } 736 727 737 $where[$k] = ''; 728 738 if ( !empty( $meta_key ) ) 729 739 $where[$k] = $wpdb->prepare( "$alias.meta_key = %s", $meta_key );