- if ( ! is_array( $excluded_terms ) ) {
- // back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
- if ( false !== strpos( $excluded_terms, ' and ' ) ) {
- _deprecated_argument( __FUNCTION__, '3.3', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
- $excluded_terms = explode( ' and ', $excluded_terms );
- } else {
- $excluded_terms = explode( ',', $excluded_terms );
- }
- }
-
- $excluded_terms = array_map( 'intval', $excluded_terms );
-
- if ( ! empty( $term_array ) ) {
- $excluded_terms = array_diff( $excluded_terms, $term_array );
- $posts_in_ex_terms_sql = '';
- }
-
- if ( ! empty( $excluded_terms ) ) {
- $posts_in_ex_terms_sql = $wpdb->prepare( " AND tt.taxonomy = %s AND tt.term_id NOT IN (" . implode( $excluded_terms, ',' ) . ')', $taxonomy );
- }
+ $where .= " AND p.ID NOT IN ( SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . implode( $excluded_terms, ',' ) . ') )';