Changeset 6683

Show
Ignore:
Timestamp:
01/29/08 19:01:39 (5 months ago)
Author:
ryan
Message:

Make sure we have a post when doing post comment feed query. Props ruckus. see #5185

Files:

Legend:

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

    r6682 r6683  
    12831283        $this->posts = apply_filters('posts_results', $this->posts); 
    12841284 
    1285         if ( $this->is_comment_feed && $this->is_singular ) { 
     1285        if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { 
    12861286            $cjoin = apply_filters('comment_feed_join', ''); 
    1287             $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = {$this->posts[0]->ID} AND comment_approved = '1'"); 
     1287            $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'"); 
    12881288            $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'); 
    12891289            $this->comments = $wpdb->get_results($comments_request);