[wp-trac] [WordPress Trac] #62801: Improve performance of X-WP-TotalPages queries
WordPress Trac
noreply at wordpress.org
Sun Oct 19 23:57:14 UTC 2025
#62801: Improve performance of X-WP-TotalPages queries
----------------------------------------------+---------------------------
Reporter: spacedmonkey | Owner: spacedmonkey
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.9
Component: REST API | Version: 3.7
Severity: normal | Resolution:
Keywords: has-patch early needs-unit-tests | Focuses: performance
----------------------------------------------+---------------------------
Comment (by peterwilsoncc):
I tend to agree, there isn't a great way to test this. It could possibly
be done using the `posts_clauses_request` filter but it would be flaky at
best.
It occurs to me that if someone has used the
`"rest_{$this->post_type}_query"` to add the argument `'no_found_rows' =>
true` the counting query will run on page two onwards without achieving
it's desired result, so it can be bypassed altogether in that case.
Alternatively, the argument could be prevented for rest requests.
Same looks to apply for the comment endpoint and possibly others.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62801#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list