Changeset 40978
- Timestamp:
- 07/01/2017 11:24:26 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r40972 r40978 642 642 * Introduced `RAND(x)` syntax for `$orderby`, which allows an integer seed value to random sorts. 643 643 * @since 4.6.0 Added 'post_name__in' support for `$orderby`. Introduced the `$lazy_load_term_meta` argument. 644 * @since 4.9.0 Introduced the `$comment_count` parameter. 644 645 * @access public 645 646 * … … 658 659 * @type array $category__not_in An array of category IDs (NOT in). 659 660 * @type string $category_name Use category slug (not name, this or any children). 661 * @type array|int $comment_count Filter results by comment count. Provide an integer to match 662 * comment count exactly. Provide an array with integer 'value' 663 * and 'compare' operator ('=', '!=', '>', '>=', '<', '<=' ) to 664 * compare against comment_count in a specific way. 660 665 * @type string $comment_status Comment status. 661 666 * @type int $comments_per_page The number of comments to return per page. … … 2141 2146 } 2142 2147 2148 // Matching by comment count. 2149 if ( isset( $q['comment_count'] ) ) { 2150 // Numeric comment count is converted to array format. 2151 if ( is_numeric( $q['comment_count'] ) ) { 2152 $q['comment_count'] = array( 2153 'value' => intval( $q['comment_count'] ), 2154 ); 2155 } 2156 2157 if ( isset( $q['comment_count']['value'] ) ) { 2158 $q['comment_count'] = array_merge( array( 2159 'compare' => '=', 2160 ), $q['comment_count'] ); 2161 2162 // Fallback for invalid compare operators is '='. 2163 $compare_operators = array( '=', '!=', '>', '>=', '<', '<=' ); 2164 if ( ! in_array( $q['comment_count']['compare'], $compare_operators, true ) ) { 2165 $q['comment_count']['compare'] = '='; 2166 } 2167 2168 $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_count {$q['comment_count']['compare']} %d", $q['comment_count']['value'] ); 2169 } 2170 } 2171 2143 2172 // MIME-Type stuff for attachment browsing 2144 2173
Note: See TracChangeset
for help on using the changeset viewer.