[wp-hackers] Re: odd posts query on 404

Casey Bisson casey.bisson at gmail.com
Thu Jan 24 19:29:05 GMT 2008


Ryan, thanks for the tip.

I've been running the fix on a few sites with no problems so far, and  
much, much better performance on the site with the over-sized posts  
table. Trac ticket #5717 addresses the issue and includes my diff:

http://trac.wordpress.org/ticket/5717

--Casey

http://MaisonBisson.com
http://library.plymouth.edu

On Jan 17, 2008, at 5:41 PM, Ryan Boren wrote:

> On Jan 17, 2008 2:21 PM, Casey Bisson <casey.bisson at gmail.com> wrote:
>> So here's my question:
>> Do we actually want to execute that query for every 404 under normal
>> circumstances? If not, is this (or something like this) the stupidest
>> solution?
>>
>> wp-includes/classes.php:WP->query_posts()
>>
>>        function query_posts() {
>>                global $wp_the_query;
>>                $this->build_query_string();
>>
>>                // return if the request URI is a 404
>>                if( $this->did_permalink && $this- 
>> >query_vars['error'] == '404' )
>>                        return;
>>
>>                $wp_the_query->query($this->query_vars);
>>        }
>>
>> The above works, but there's probably a better way to write it.
>
> wp-includes/canonical.php and some 404 templates expect that
> WP_Query::parse_request() has run.  I think calling that on its own
> without calling the DB parts of WP_Query would work.
>
> Ryan
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list