Changeset 12409 for trunk/wp-includes/query.php
- Timestamp:
- 12/15/2009 09:01:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r12393 r12409 1785 1785 1786 1786 if ( !empty($q['category__not_in']) ) { 1787 if ( $wpdb->has_cap( 'subqueries' ) ) { 1788 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1789 $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) )"; 1790 } else { 1791 $ids = get_objects_in_term($q['category__not_in'], 'category'); 1792 if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) 1793 $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; 1794 } 1787 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1788 $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) )"; 1795 1789 } 1796 1790 … … 1875 1869 1876 1870 if ( !empty($q['tag__not_in']) ) { 1877 if ( $wpdb->has_cap( 'subqueries' ) ) { 1878 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1879 $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) )"; 1880 } else { 1881 $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); 1882 if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) 1883 $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; 1884 } 1871 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1872 $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) )"; 1885 1873 } 1886 1874
Note: See TracChangeset
for help on using the changeset viewer.