Ticket #8731: 8731.2.diff
File 8731.2.diff, 1.4 KB (added by , 16 years ago) |
---|
-
wp-includes/query.php
1582 1582 $search = ''; 1583 1583 $groupby = ''; 1584 1584 $fields = "$wpdb->posts.*"; 1585 $post_status_join = false;1586 1585 $page = 1; 1587 1586 1588 1587 if ( !isset($q['caller_get_posts']) ) … … 1958 1957 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 1959 1958 $post_type = 'any'; 1960 1959 $q['post_status'] = 'publish'; 1961 $post_status_join = true;1962 1960 } else { 1963 1961 $whichcat = " AND 0 "; 1964 1962 } … … 2065 2063 } 2066 2064 2067 2065 if ( 'any' == $post_type ) { 2068 $where .= '';2066 $where .= " AND $wpdb->posts.post_type != 'revision'"; 2069 2067 } elseif ( $this->is_attachment ) { 2070 2068 $where .= " AND $wpdb->posts.post_type = 'attachment'"; 2071 2069 } elseif ($this->is_page) { … … 2111 2109 else 2112 2110 $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")"; 2113 2111 } 2114 if ( $post_status_join ) {2115 $join .= " JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";2116 foreach ( $statuswheres as $index => $statuswhere )2117 $statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";2118 }2119 2112 foreach ( $statuswheres as $statuswhere ) 2120 2113 $where .= " AND $statuswhere"; 2121 2114 } elseif ( !$this->is_singular ) {