From 14ac0702da611069131b470cbc57954ccd53cd57 Mon Sep 17 00:00:00 2001 From: Mark Jaquith 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: https://develop.svn.wordpress.org/trunk@11817 602fd350-edb4-49c9-b593-d223f7449a82 --- 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'] ) {