Make WordPress Core

Changeset 11259

Timestamp:
05/11/2009 04:56:00 AM (16 years ago)
Author:
ryan
Message:

JOIN instead of LEFT JOIN. Props Denis-de-Bernardy. fixes #9720

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r11230 r11259  
    21102110            }
    21112111            if ( $post_status_join ) {
    2112                 $join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
     2112                $join .= " JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
    21132113                foreach ( $statuswheres as $index => $statuswhere )
    21142114                    $statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
     
    21312131        // postmeta queries
    21322132        if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
    2133             $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
     2133            $join .= " JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
    21342134        if ( ! empty($q['meta_key']) )
    21352135            $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
     
    21692169        if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
    21702170            if ( $this->is_archive || $this->is_search ) {
    2171                 $cjoin = "LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
     2171                $cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
    21722172                $cwhere = "WHERE comment_approved = '1' $where";
    21732173                $cgroupby = "$wpdb->comments.comment_id";
    21742174            } else { // Other non singular e.g. front
    2175                 $cjoin = "LEFT JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )";
     2175                $cjoin = "JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )";
    21762176                $cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'";
    21772177                $cgroupby = '';
Note: See TracChangeset for help on using the changeset viewer.