Opened 2 years ago
Closed 10 months ago
#17195 closed enhancement (invalid)
Lazy load $wp_query->found_posts
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | pavelevap@… |
Description (last modified by scribu)
prettyboymp in #10964:
For the most part, the found posts result is only needed for the main loop where paging is involved, yet, most developers don't know to add the 'no_found_rows' parameter to every single WP_Query request where they don't need paging. It would require creating a magic get() method for backwards compatibility, but it can throw a deprecated warning and switch to a real getter implementation.
Change History (7)
- Cc pavelevap@… added
So, this problem is also related to default Recent Posts widget? I did not find parameter no_found_rows there and pagination is not required. I had some problems with slow queries which disappeared after removing this widget in the past...
Indeed. It sets 'nopaging' => 0 for some reason, although it also sets 'posts_per_page'.
- Milestone Future Release deleted
- Resolution set to invalid
- Status changed from new to closed
Actually, lazy loading found_posts isn't really possible since the query is dependent on the previously executed query, the one that contains SQL_CALC_FOUND_ROWS.
Would have been nice, though.

Similar: #15773