Opened 14 years ago
Closed 12 years ago
#17195 closed enhancement (invalid)
Lazy load $wp_query->found_posts
Reported by: | scribu | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
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)
#4
@
14 years ago
- 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...
#5
@
14 years ago
Indeed. It sets 'nopaging' => 0
for some reason, although it also sets 'posts_per_page'.
See #17203
#7
@
12 years ago
- 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