WordPress.org

Make WordPress Core

Ticket #8731: 8731.2.diff

File 8731.2.diff, 1.4 KB (added by ryan, 4 years ago)
  • wp-includes/query.php

     
    15821582                $search = ''; 
    15831583                $groupby = ''; 
    15841584                $fields = "$wpdb->posts.*"; 
    1585                 $post_status_join = false; 
    15861585                $page = 1; 
    15871586 
    15881587                if ( !isset($q['caller_get_posts']) ) 
     
    19581957                                        $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 
    19591958                                        $post_type = 'any'; 
    19601959                                        $q['post_status'] = 'publish'; 
    1961                                         $post_status_join = true; 
    19621960                                } else { 
    19631961                                        $whichcat = " AND 0 "; 
    19641962                                } 
     
    20652063                } 
    20662064 
    20672065                if ( 'any' == $post_type ) { 
    2068                         $where .= ''; 
     2066                        $where .= " AND $wpdb->posts.post_type != 'revision'"; 
    20692067                } elseif ( $this->is_attachment ) { 
    20702068                        $where .= " AND $wpdb->posts.post_type = 'attachment'"; 
    20712069                } elseif ($this->is_page) { 
     
    21112109                                else 
    21122110                                        $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")"; 
    21132111                        } 
    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                         } 
    21192112                        foreach ( $statuswheres as $statuswhere ) 
    21202113                                $where .= " AND $statuswhere"; 
    21212114                } elseif ( !$this->is_singular ) {