Disambiguate queries. Props mhyk25. fixes #3747
git-svn-id: http://svn.automattic.com/wordpress/trunk@4866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cab399a6ae
commit
1d054e4894
|
@ -794,16 +794,16 @@ class WP_Query {
|
|||
$in_cats = substr($in_cats, 0, -2);
|
||||
$out_cats = substr($out_cats, 0, -2);
|
||||
if ( strlen($in_cats) > 0 )
|
||||
$in_cats = " AND category_id IN ($in_cats)";
|
||||
$in_cats = " AND $wpdb->post2cat.category_id IN ($in_cats)";
|
||||
if ( strlen($out_cats) > 0 ) {
|
||||
$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id IN ($out_cats)");
|
||||
$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE $wpdb->post2cat.category_id IN ($out_cats)");
|
||||
if ( is_array($ids) && count($ids > 0) ) {
|
||||
foreach ( $ids as $id )
|
||||
$out_posts .= "$id, ";
|
||||
$out_posts = substr($out_posts, 0, -2);
|
||||
}
|
||||
if ( strlen($out_posts) > 0 )
|
||||
$out_cats = " AND ID NOT IN ($out_posts)";
|
||||
$out_cats = " AND $wpdb->posts.ID NOT IN ($out_posts)";
|
||||
else
|
||||
$out_cats = '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue