From 725a6787b28e16ea4278ed8a3fa5fe7671aed917 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Sat, 15 Aug 2009 03:28:03 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 0747a0a8b0..6a64b05e40 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2072,14 +2072,14 @@ class WP_Query { if ( 'any' == $post_type ) { $where .= " AND $wpdb->posts.post_type != 'revision'"; + } elseif ( ! empty( $post_type ) ) { + $where .= " AND $wpdb->posts.post_type = '$post_type'"; } elseif ( $this->is_attachment ) { $where .= " AND $wpdb->posts.post_type = 'attachment'"; } elseif ($this->is_page) { $where .= " AND $wpdb->posts.post_type = 'page'"; } elseif ($this->is_single) { $where .= " AND $wpdb->posts.post_type = 'post'"; - } else { - $where .= " AND $wpdb->posts.post_type = '$post_type'"; } if ( isset($q['post_status']) && '' != $q['post_status'] ) {