[wp-trac] [WordPress Trac] #16450: query_posts problem with pagination
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 3 14:04:04 UTC 2011
#16450: query_posts problem with pagination
--------------------------+------------------------------
Reporter: danielpataki | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: minor | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by danielpataki):
Replying to [comment:1 dd32]:
> The simple response here, Is to not use query_posts.
>
> You'd be far better off modifying the request before WordPress handles
it, for example, on one of the filters such as `pre_get_posts` or perhaps
one of the others (Its late, I apologise) such as parse_request (which may
not be the right time).
>
> As you've found, using `query_posts` requires 2 queries, which means the
first query basically needs to have the same contents (Remember, WordPress
has not loaded, nor knows about the code in the template files at the time
of 404'ing), If you modify the request before it's sent to the database,
then a 404 will literally only occur when the query was empty..
Oh what an awesome response, thank you! For some reason it never occurred
to me to use a filter, God knows why. I will close this if I can, since
using a filter like you said is definitely the way to go and this is not a
defect for sure, thanks so much!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16450#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list