[wp-trac] [WordPress Trac] #16450: query_posts problem with pagination

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 3 13:29: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 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..

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16450#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list