Opened 7 years ago
Last modified 7 years ago
#42256 new defect (bug)
Skip SQL_CALC_FOUND_ROWS when using post__in whose count matches posts_per_page
Reported by: | ethitter | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
If a post__in
array is passed to WP_Query whose length matches the posts_per_page
value for the query, SQL_CALC_FOUND_ROWS
is unnecessary.
Attachments (2)
Change History (5)
#2
@
7 years ago
What if the values in post__in
point to non-existent posts? Or, perhaps more likely, what if the combination of post__in
with some other param (say, a meta_query
) makes it so that only a subset of the post__in
items are grabbed?
It feels safer to let plugins decide whether they're passing query parameters that guarantee that all and only the items in post__in
will end up in the results array. If the plugin knows this, it can pass no_found_rows
explicitly.
Note: See
TracTickets for help on using
tickets.
42256.2.diff adds a test.