Changeset 9031
- Timestamp:
- 09/29/2008 09:24:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r8968 r9031 1804 1804 if ( $wpdb->has_cap( 'subqueries' ) ) { 1805 1805 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1806 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT $wpdb->term_relationships.object_id FROM $wpdb->term_relationships WHERE $wpdb->term_relationships.term_taxonomy_id IN ($cat_string) )";1806 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )"; 1807 1807 } else { 1808 1808 $ids = get_objects_in_term($q['category__not_in'], 'category'); 1809 1809 if ( is_wp_error( $ids ) ) 1810 return $ids;1810 $ids = array(); 1811 1811 if ( is_array($ids) && count($ids > 0) ) { 1812 1812 $out_posts = "'" . implode("', '", $ids) . "'"; … … 1895 1895 1896 1896 if ( !empty($q['tag__not_in']) ) { 1897 $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); 1898 if ( is_array($ids) && count($ids > 0) ) { 1899 $out_posts = "'" . implode("', '", $ids) . "'"; 1900 $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)"; 1897 if ( $wpdb->has_cap( 'subqueries' ) ) { 1898 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1899 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )"; 1900 } else { 1901 $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); 1902 if ( is_wp_error( $ids ) ) 1903 $ids = array(); 1904 if ( is_array($ids) && count($ids > 0) ) { 1905 $out_posts = "'" . implode("', '", $ids) . "'"; 1906 $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)"; 1907 } 1901 1908 } 1902 1909 }
Note: See TracChangeset
for help on using the changeset viewer.