Respect the post_type param for Taxonomy Queries, Props Otto & Dougal Campbell. Restrict Attachment post_status joins to queries involving attachment results ("any" or "attachment"). See #13020

git-svn-id: http://svn.automattic.com/wordpress/trunk@14121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-04-17 09:03:33 +00:00
parent 629432887e
commit 41c63bd520

View File

@ -2031,9 +2031,13 @@ class WP_Query {
$post_ids = get_objects_in_term($term_ids, $taxonomy);
if ( !is_wp_error($post_ids) && !empty($post_ids) ) {
$whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
$post_type = 'any';
if ( '' === $post_type ) {
$post_type = 'any';
$post_status_join = true;
} elseif ( in_array('attachment', (array)$post_type) ) {
$post_status_join = true;
}
$q['post_status'] = 'publish';
$post_status_join = true;
} else {
$whichcat = " AND 0 ";
}
@ -2292,9 +2296,8 @@ class WP_Query {
// Paging
if ( empty($q['nopaging']) && !$this->is_singular ) {
$page = absint($q['paged']);
if (empty($page)) {
if ( empty($page) )
$page = 1;
}
if ( empty($q['offset']) ) {
$pgstrt = '';