Changeset 3886 for trunk/wp-includes/query.php
- Timestamp:
- 06/19/2006 05:14:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r3869 r3886 709 709 $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) "; 710 710 $cat_array = preg_split('/[,\s]+/', $q['cat']); 711 $in_cats = $out_cats = '';711 $in_cats = $out_cats = $out_posts = ''; 712 712 foreach ( $cat_array as $cat ) { 713 713 $cat = intval($cat); … … 723 723 if ( strlen($in_cats) > 0 ) 724 724 $in_cats = " AND category_id IN ($in_cats)"; 725 if ( strlen($out_cats) > 0 ) 726 $out_cats = " AND category_id NOT IN ($out_cats)"; 725 if ( strlen($out_cats) > 0 ) { 726 $ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id IN ($out_cats)"); 727 if ( is_array($ids) && count($ids > 0) ) { 728 foreach ( $ids as $id ) 729 $out_posts .= "$id, "; 730 $out_posts = substr($out_posts, 0, -2); 731 } 732 if ( strlen($out_posts) > 0 ) 733 $out_cats = " AND ID NOT IN ($out_posts)"; 734 } 727 735 $whichcat = $in_cats . $out_cats; 728 736 $distinct = 'DISTINCT';
Note: See TracChangeset
for help on using the changeset viewer.