Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#17195 closed enhancement (invalid)

Lazy load $wp_query->found_posts

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:

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)

#1 @scribu
13 years ago

  • Description modified (diff)

#2 @scribu
13 years ago

Similar: #15773

#3 @scribu
13 years ago

Related: #17066

#4 @pavelevap
13 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 @scribu
13 years ago

Indeed. It sets 'nopaging' => 0 for some reason, although it also sets 'posts_per_page'.

Version 0, edited 13 years ago by scribu (next)

#6 @ryan
13 years ago

  • Milestone changed from 3.2 to Future Release

#7 @scribu
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.

Note: See TracTickets for help on using tickets.