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: https://develop.svn.wordpress.org/trunk@14121 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-04-17 09:03:33 +00:00
parent 73da12c509
commit 66e73d0f64
1 changed files with 7 additions and 4 deletions

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 = '';