Ticket #39142: 39142.patch
| File 39142.patch, 1.8 KB (added by , 9 years ago) |
|---|
-
wp-includes/class-wp-comment-query.php
946 946 0 => wp_list_pluck( $comments, 'comment_ID' ), 947 947 ); 948 948 949 /*950 * The WHERE clause for the descendant query is the same as for the top-level951 * query, minus the `parent`, `parent__in`, and `parent__not_in` sub-clauses.952 */953 $_where = $this->filtered_where_clause;954 $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' );955 foreach ( $exclude_keys as $exclude_key ) {956 if ( isset( $this->sql_clauses['where'][ $exclude_key ] ) ) {957 $clause = $this->sql_clauses['where'][ $exclude_key ];958 959 // Strip the clause as well as any adjacent ANDs.960 $pattern = '|(?:AND)?\s*' . $clause . '\s*(?:AND)?|';961 $_where_parts = preg_split( $pattern, $_where );962 963 // Remove empties.964 $_where_parts = array_filter( array_map( 'trim', $_where_parts ) );965 966 // Reassemble with an AND.967 $_where = implode( ' AND ', $_where_parts );968 }969 }970 971 949 $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) ); 972 950 $last_changed = wp_cache_get_last_changed( 'comment' ); 973 951 … … 990 968 if ( $uncached_parent_ids ) { 991 969 // Fetch this level of comments. 992 970 $parent_query_args = $this->query_vars; 971 /* 972 * The params for the descendant query is the same as for the top-level 973 * query, minus the `parent`, `parent__in`, and `parent__not_in` sub-clauses. 974 */ 975 $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' ); 993 976 foreach ( $exclude_keys as $exclude_key ) { 994 977 $parent_query_args[ $exclude_key ] = ''; 995 978 }