Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -295,8 +295,9 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||
unset( $prepared_args['number'], $prepared_args['offset'] );
|
||||
|
||||
$query = new WP_Comment_Query();
|
||||
$prepared_args['count'] = true;
|
||||
$query = new WP_Comment_Query();
|
||||
$prepared_args['count'] = true;
|
||||
$prepared_args['orderby'] = 'none';
|
||||
|
||||
$total_comments = $query->query( $prepared_args );
|
||||
$max_pages = ceil( $total_comments / $request['per_page'] );
|
||||
@@ -1039,8 +1040,9 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
// Restores the more descriptive, specific name for use within this method.
|
||||
$comment = $item;
|
||||
$fields = $this->get_fields_for_response( $request );
|
||||
$data = array();
|
||||
|
||||
$fields = $this->get_fields_for_response( $request );
|
||||
$data = array();
|
||||
|
||||
if ( in_array( 'id', $fields, true ) ) {
|
||||
$data['id'] = (int) $comment->comment_ID;
|
||||
@@ -1187,8 +1189,8 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
// Only grab one comment to verify the comment has children.
|
||||
$comment_children = $comment->get_children(
|
||||
array(
|
||||
'number' => 1,
|
||||
'count' => true,
|
||||
'count' => true,
|
||||
'orderby' => 'none',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user