Always respect custom post_type in queries. props dd32, filosofo. fixes #10605

git-svn-id: http://svn.automattic.com/wordpress/trunk@11817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2009-08-15 03:28:03 +00:00
parent b9c5a29b69
commit 725a6787b2
1 changed files with 2 additions and 2 deletions

View File

@ -2072,14 +2072,14 @@ class WP_Query {
if ( 'any' == $post_type ) { if ( 'any' == $post_type ) {
$where .= " AND $wpdb->posts.post_type != 'revision'"; $where .= " AND $wpdb->posts.post_type != 'revision'";
} elseif ( ! empty( $post_type ) ) {
$where .= " AND $wpdb->posts.post_type = '$post_type'";
} 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) {
$where .= " AND $wpdb->posts.post_type = 'page'"; $where .= " AND $wpdb->posts.post_type = 'page'";
} elseif ($this->is_single) { } elseif ($this->is_single) {
$where .= " AND $wpdb->posts.post_type = 'post'"; $where .= " AND $wpdb->posts.post_type = 'post'";
} else {
$where .= " AND $wpdb->posts.post_type = '$post_type'";
} }
if ( isset($q['post_status']) && '' != $q['post_status'] ) { if ( isset($q['post_status']) && '' != $q['post_status'] ) {