diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 8b5b7e2cb3..8961c0b92a 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -140,6 +140,7 @@ class WP_Comment_Query { * `$hierarchical`, and `$update_comment_post_cache` were added. * @since 4.5.0 Introduced the `$author_url` argument. * @since 4.6.0 Introduced the `$cache_domain` argument. + * @since 4.9.0 Introduced the `$paged` argument. * * @param string|array $query { * Optional. Array or query string of comment query parameters. Default empty. @@ -170,6 +171,8 @@ class WP_Comment_Query { * See WP_Meta_Query. Default empty. * @type int $number Maximum number of comments to retrieve. * Default empty (no limit). + * @type int $paged When used with $number, defines the page of results to return. + * When used with $offset, $offset takes precedence. Default 1. * @type int $offset Number of comments to offset the query. Used to build * LIMIT clause. Default 0. * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. @@ -263,6 +266,7 @@ class WP_Comment_Query { 'no_found_rows' => true, 'orderby' => '', 'order' => 'DESC', + 'paged' => 1, 'parent' => '', 'parent__in' => '', 'parent__not_in' => '', @@ -628,12 +632,13 @@ class WP_Comment_Query { $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); + $paged = absint( $this->query_vars['paged'] ); if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { - $limits = 'LIMIT ' . $number; + $limits = 'LIMIT ' . ( $number * ( $paged - 1 ) ) . ',' . $number; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 7e801aeda3..d8c85610c7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41286'; +$wp_version = '4.9-alpha-41287'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.