Ticket #29885: 29885.2.diff
File 29885.2.diff, 1.6 KB (added by , 11 years ago) |
---|
-
wp-includes/comment.php
258 258 * 259 259 * @since 3.1.0 260 260 * @since 4.1.0 Introduced 'comment__in', 'comment__not_in', 261 * 'post_author__in', 'post_author__not_in', 261 262 * 'post__in', and 'post__not_in' to $query_vars. 262 263 * 263 264 * @param string|array $query_vars … … 278 279 'orderby' => '', 279 280 'order' => 'DESC', 280 281 'parent' => '', 282 'post_author__in' => '', 283 'post_author__not_in' => '', 281 284 'post_ID' => '', 282 285 'post_id' => 0, 283 286 'post__in' => '', … … 475 478 foreach( $post_fields as $field_name => $field_value ) 476 479 $where .= $wpdb->prepare( " AND {$wpdb->posts}.{$field_name} = %s", $field_value ); 477 480 } 481 482 if ( ! empty( $this->query_vars['post_author__in'] ) ) { 483 if ( empty( $join ) ) { 484 $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID"; 485 } 486 $where .= ' AND post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )'; 487 } 478 488 489 if ( ! empty( $this->query_vars['post_author__not_in'] ) ) { 490 if ( empty( $join ) ) { 491 $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID"; 492 } 493 $where .= ' AND post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )'; 494 } 495 479 496 if ( ! empty( $this->meta_query->queries ) ) { 480 497 $clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this ); 481 498 $join .= $clauses['join'];