Make WordPress Core

Changeset 6683


Ignore:
Timestamp:
01/29/2008 07:01:39 PM (17 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.