3229 | | if ( !$q['suppress_filters'] ) { |
3230 | | /** |
3231 | | * Filters the JOIN clause of the comments feed query before sending. |
3232 | | * |
3233 | | * @since 2.2.0 |
3234 | | * |
3235 | | * @param string $cjoin The JOIN clause of the query. |
3236 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
3237 | | */ |
3238 | | $cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) ); |
| 3220 | $comment_args = array( |
| 3221 | 'orderby' => 'comment_date_gmt', |
| 3222 | 'order' => 'DESC', |
| 3223 | 'status' => 'approve', |
| 3224 | 'post__in' => wp_list_pluck( $this->posts, 'ID' ), |
| 3225 | 'no_found_rows' => false, |
| 3226 | 'number' => get_option( 'posts_per_rss' ), |
| 3227 | 'suppress_filters' => $q['suppress_filters'], |
| 3228 | 'update_comment_meta_cache' => false, // We lazy-load comment meta for performance. |
| 3229 | ); |
3240 | | /** |
3241 | | * Filters the WHERE clause of the comments feed query before sending. |
3242 | | * |
3243 | | * @since 2.2.0 |
3244 | | * |
3245 | | * @param string $cwhere The WHERE clause of the query. |
3246 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
3247 | | */ |
3248 | | $cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) ); |
3249 | | |
3250 | | /** |
3251 | | * Filters the GROUP BY clause of the comments feed query before sending. |
3252 | | * |
3253 | | * @since 2.2.0 |
3254 | | * |
3255 | | * @param string $cgroupby The GROUP BY clause of the query. |
3256 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
3257 | | */ |
3258 | | $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) ); |
3259 | | |
3260 | | /** |
3261 | | * Filters the ORDER BY clause of the comments feed query before sending. |
3262 | | * |
3263 | | * @since 2.8.0 |
3264 | | * |
3265 | | * @param string $corderby The ORDER BY clause of the query. |
3266 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
3267 | | */ |
3268 | | $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); |
3269 | | |
3270 | | /** |
3271 | | * Filters the LIMIT clause of the comments feed query before sending. |
3272 | | * |
3273 | | * @since 2.8.0 |
3274 | | * |
3275 | | * @param string $climits The JOIN clause of the query. |
3276 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
3277 | | */ |
3278 | | $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) ); |
3279 | | } |
3280 | | $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; |
3281 | | $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; |
3282 | | |
3283 | | $comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"); |
3284 | | // Convert to WP_Comment |
3285 | | $this->comments = array_map( 'get_comment', $comments ); |
| 3231 | $comment_args = apply_filters( 'comments_feed_query_args', $comment_args ); |
| 3232 | $comment_query = new WP_Comment_Query( $comment_args ); |
| 3233 | $this->comments = $comment_query->comments; |
3641 | | /** This filter is documented in wp-includes/query.php */ |
3642 | | $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) ); |
| 3587 | $comment_args = array( |
| 3588 | 'orderby' => 'comment_date_gmt', |
| 3589 | 'order' => 'DESC', |
| 3590 | 'status' => 'approve', |
| 3591 | 'post_id' => $this->posts[0]->ID, |
| 3592 | 'no_found_rows' => false, |
| 3593 | 'number' => get_option( 'posts_per_rss' ), |
| 3594 | 'update_comment_meta_cache' => false, // We lazy-load comment meta for performance. |
| 3595 | 'suppress_filters' => $q['suppress_filters'], |
| 3596 | ); |
3644 | | /** This filter is documented in wp-includes/query.php */ |
3645 | | $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) ); |
3646 | | $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; |
3647 | | |
3648 | | /** This filter is documented in wp-includes/query.php */ |
3649 | | $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); |
3650 | | $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; |
3651 | | |
3652 | | /** This filter is documented in wp-includes/query.php */ |
3653 | | $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) ); |
3654 | | |
3655 | | $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"; |
3656 | | $comments = $wpdb->get_results($comments_request); |
3657 | | // Convert to WP_Comment |
3658 | | $this->comments = array_map( 'get_comment', $comments ); |
| 3598 | $comment_args = apply_filters( 'comments_feed_query_args', $comment_args ); |
| 3599 | $comment_query = new WP_Comment_Query( $comment_args ); |
| 3600 | $this->comments = $comment_query->comments; |