File tree Expand file tree Collapse file tree 4 files changed +21
-7
lines changed
src/wp-includes/rest-api/endpoints Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -295,9 +295,10 @@ public function get_items( $request ) {
295295 // Out-of-bounds, run the query again without LIMIT for total count.
296296 unset( $ prepared_args ['number ' ], $ prepared_args ['offset ' ] );
297297
298- $ query = new WP_Comment_Query ();
299- $ prepared_args ['count ' ] = true ;
300- $ prepared_args ['orderby ' ] = 'none ' ;
298+ $ query = new WP_Comment_Query ();
299+ $ prepared_args ['count ' ] = true ;
300+ $ prepared_args ['orderby ' ] = 'none ' ;
301+ $ prepared_args ['update_comment_meta_cache ' ] = false ;
301302
302303 $ total_comments = $ query ->query ( $ prepared_args );
303304 $ max_pages = (int ) ceil ( $ total_comments / $ request ['per_page ' ] );
Original file line number Diff line number Diff line change @@ -195,7 +195,13 @@ public function get_items( $request ) {
195195 if ( $ total_revisions < 1 ) {
196196 // Out-of-bounds, run the query again without LIMIT for total count.
197197 unset( $ query_args ['paged ' ], $ query_args ['offset ' ] );
198- $ count_query = new WP_Query ();
198+
199+ $ count_query = new WP_Query ();
200+ $ query_args ['fields ' ] = 'ids ' ;
201+ $ query_args ['posts_per_page ' ] = 1 ;
202+ $ query_args ['update_post_meta_cache ' ] = false ;
203+ $ query_args ['update_post_term_cache ' ] = false ;
204+
199205 $ count_query ->query ( $ query_args );
200206
201207 $ total_revisions = $ count_query ->found_posts ;
Original file line number Diff line number Diff line change @@ -464,7 +464,12 @@ static function ( $format ) {
464464 // Out-of-bounds, run the query again without LIMIT for total count.
465465 unset( $ query_args ['paged ' ] );
466466
467- $ count_query = new WP_Query ();
467+ $ count_query = new WP_Query ();
468+ $ query_args ['fields ' ] = 'ids ' ;
469+ $ query_args ['posts_per_page ' ] = 1 ;
470+ $ query_args ['update_post_meta_cache ' ] = false ;
471+ $ query_args ['update_post_term_cache ' ] = false ;
472+
468473 $ count_query ->query ( $ query_args );
469474 $ total_posts = $ count_query ->found_posts ;
470475 }
Original file line number Diff line number Diff line change @@ -367,8 +367,10 @@ public function get_items( $request ) {
367367 if ( $ total_users < 1 ) {
368368 // Out-of-bounds, run the query again without LIMIT for total count.
369369 unset( $ prepared_args ['number ' ], $ prepared_args ['offset ' ] );
370- $ count_query = new WP_User_Query ( $ prepared_args );
371- $ total_users = $ count_query ->get_total ();
370+
371+ $ prepared_args ['number ' ] = 1 ;
372+ $ count_query = new WP_User_Query ( $ prepared_args );
373+ $ total_users = $ count_query ->get_total ();
372374 }
373375
374376 $ response ->header ( 'X-WP-Total ' , (int ) $ total_users );
You can’t perform that action at this time.
0 commit comments