Lose broken post_status_join. Exclude revisions from post_type = any queries. Props gortsleigh. fixes #8731
git-svn-id: https://develop.svn.wordpress.org/trunk@11392 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
846cdf43c9
commit
1f9c258540
|
@ -1582,7 +1582,6 @@ class WP_Query {
|
||||||
$search = '';
|
$search = '';
|
||||||
$groupby = '';
|
$groupby = '';
|
||||||
$fields = "$wpdb->posts.*";
|
$fields = "$wpdb->posts.*";
|
||||||
$post_status_join = false;
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
|
|
||||||
if ( !isset($q['caller_get_posts']) )
|
if ( !isset($q['caller_get_posts']) )
|
||||||
|
@ -1958,7 +1957,6 @@ class WP_Query {
|
||||||
$whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
|
$whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
|
||||||
$post_type = 'any';
|
$post_type = 'any';
|
||||||
$q['post_status'] = 'publish';
|
$q['post_status'] = 'publish';
|
||||||
$post_status_join = true;
|
|
||||||
} else {
|
} else {
|
||||||
$whichcat = " AND 0 ";
|
$whichcat = " AND 0 ";
|
||||||
}
|
}
|
||||||
|
@ -2065,7 +2063,7 @@ class WP_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'any' == $post_type ) {
|
if ( 'any' == $post_type ) {
|
||||||
$where .= '';
|
$where .= " AND $wpdb->posts.post_type != 'revision'";
|
||||||
} elseif ( $this->is_attachment ) {
|
} elseif ( $this->is_attachment ) {
|
||||||
$where .= " AND $wpdb->posts.post_type = 'attachment'";
|
$where .= " AND $wpdb->posts.post_type = 'attachment'";
|
||||||
} elseif ($this->is_page) {
|
} elseif ($this->is_page) {
|
||||||
|
@ -2111,11 +2109,6 @@ class WP_Query {
|
||||||
else
|
else
|
||||||
$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
|
$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
|
||||||
}
|
}
|
||||||
if ( $post_status_join ) {
|
|
||||||
$join .= " JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
|
|
||||||
foreach ( $statuswheres as $index => $statuswhere )
|
|
||||||
$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
|
|
||||||
}
|
|
||||||
foreach ( $statuswheres as $statuswhere )
|
foreach ( $statuswheres as $statuswhere )
|
||||||
$where .= " AND $statuswhere";
|
$where .= " AND $statuswhere";
|
||||||
} elseif ( !$this->is_singular ) {
|
} elseif ( !$this->is_singular ) {
|
||||||
|
|
Loading…
Reference in New Issue