[wp-trac] [WordPress Trac] #5717: 404 handling optimization

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 24 19:15:09 GMT 2008


#5717: 404 handling optimization
--------------------------+-------------------------------------------------
 Reporter:  misterbisson  |       Owner:  anonymous                     
     Type:  defect        |      Status:  new                           
 Priority:  normal        |   Milestone:  2.6                           
Component:  Optimization  |     Version:  2.3.2                         
 Severity:  normal        |    Keywords:  404, optimization, query_posts
--------------------------+-------------------------------------------------
 With permalinks enabled, requests for non-existing URL paths result in a
 resource intensive select. The problem is that WP::query_posts() doesn't
 halt execution when WP::parse_request() 404s, causing
 WP_Query::get_posts() to fetch the x most recent posts. More details:
 http://maisonbisson.com/blog/post/12035 .

 The attached patch simply short-circuits WP::query_posts() if there's a
 404. At rboren's suggestion, it also calls WP_Query::parse_query(), as
 some templates expect it to have run.

 Honestly not sure if did_permalink is necessary, but the code works in my
 environments.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5717>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list