From c0a461e6fe94228f3a9ac3e84fabcb999a2838f6 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 30 Mar 2012 13:08:12 +0000 Subject: [PATCH] Always pass a table alias to wp_post_mime_type_where(). Prevents ambiguous queries when adding joins later on. props benbalter, fixes #20193. git-svn-id: http://svn.automattic.com/wordpress/trunk@20325 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 9a69ac6ab..303a39527 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2311,10 +2311,8 @@ class WP_Query { // MIME-Type stuff for attachment browsing - if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) { - $table_alias = $post_status_join ? $wpdb->posts : ''; - $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias); - } + if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) + $whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts ); $where .= $search . $whichauthor . $whichmimetype;