Ticket #29718: 29718.3.diff
File 29718.3.diff, 1.8 KB (added by , 11 years ago) |
---|
-
wp-includes/taxonomy.php
997 997 ); 998 998 999 999 $join = ''; 1000 $where = ''; 1000 1001 1001 1002 $this->clean_query( $clause ); 1002 1003 … … 1040 1041 1041 1042 } elseif ( 'NOT IN' == $operator ) { 1042 1043 1043 if ( empty( $terms ) ) { 1044 continue; 1045 } 1044 if ( ! empty( $terms ) ) { 1045 $terms = implode( ',', $terms ); 1046 1047 $where = "$this->primary_table.$this->primary_id_column NOT IN ( 1048 SELECT object_id 1049 FROM $wpdb->term_relationships 1050 WHERE term_taxonomy_id IN ($terms) 1051 )"; 1052 } 1046 1053 1047 $terms = implode( ',', $terms );1048 1049 $where = "$this->primary_table.$this->primary_id_column NOT IN (1050 SELECT object_id1051 FROM $wpdb->term_relationships1052 WHERE term_taxonomy_id IN ($terms)1053 )";1054 1055 1054 } elseif ( 'AND' == $operator ) { 1055 if ( ! empty( $terms ) ) { 1056 $num_terms = count( $terms ); 1057 1058 $terms = implode( ',', $terms ); 1059 1060 $where = "( 1061 SELECT COUNT(1) 1062 FROM $wpdb->term_relationships 1063 WHERE term_taxonomy_id IN ($terms) 1064 AND object_id = $this->primary_table.$this->primary_id_column 1065 ) = $num_terms"; 1066 } 1056 1067 1057 if ( empty( $terms ) ) {1058 continue;1059 }1060 1061 $num_terms = count( $terms );1062 1063 $terms = implode( ',', $terms );1064 1065 $where = "(1066 SELECT COUNT(1)1067 FROM $wpdb->term_relationships1068 WHERE term_taxonomy_id IN ($terms)1069 AND object_id = $this->primary_table.$this->primary_id_column1070 ) = $num_terms";1071 1072 1068 } elseif ( 'NOT EXISTS' === $operator || 'EXISTS' === $operator ) { 1073 1069 1074 1070 $where = $wpdb->prepare( "$operator (