wip
This commit is contained in:
@@ -487,10 +487,15 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
$total_posts = $posts_query->found_posts;
|
||||
|
||||
if ( $total_posts < 1 && $page > 1 ) {
|
||||
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||
// Out-of-bounds, run the query without pagination/offset to get the total count.
|
||||
unset( $query_args['paged'] );
|
||||
|
||||
$count_query = new WP_Query();
|
||||
$count_query = new WP_Query();
|
||||
$query_args['fields'] = 'ids';
|
||||
$query_args['posts_per_page'] = 1;
|
||||
$query_args['update_post_meta_cache'] = false;
|
||||
$query_args['update_post_term_cache'] = false;
|
||||
|
||||
$count_query->query( $query_args );
|
||||
$total_posts = $count_query->found_posts;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user