[wp-trac] [WordPress Trac] #19728: WP_Query should constrict 'paged' to be within bounds of found_posts
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 7 22:48:58 UTC 2012
#19728: WP_Query should constrict 'paged' to be within bounds of found_posts
-------------------------+------------------------------
Reporter: Master Jake | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------------------
Comment (by kawauso):
As it stands to my rather limited understanding, passing an overly high
'paged' value results in a SQL LIMIT being used which causes MySQL to
return no rows/posts and the 'found_posts' value on which 'max_num_pages'
is based is only available after this initial query, so WP_Query would
have to perform a second query to retrieve in-bounds posts.
'paged' values less than 1 are already corrected for in `get_posts()`
before the initial query is constructed.
I don't really see why this should be the role of core, not least because
it would change the expected output. If it's desirable to always have
posts found, then it'd be straightforward enough to check for this and re-
perform the query at theme/plugin level.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19728#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list