[wp-hackers] Any way to bypass $wp->query_posts()?

Jennifer Hodgdon yahgrp at poplarware.com
Mon Apr 6 14:22:55 GMT 2009

Mike Schinkel wrote:
>>> You could also use one of the hooks inside query_posts, to override 
> parts of the query, such as the where section, 
> Yeah, i guess I could do "WHERE 1=0" but it still sends the query to MySQL which is suboptimal.
>>> and I think even the whole query.
> AFAICT there's no way to bypass the query in that function. I've poured over that section of code for several hours now. Hoping that adding something to allow bypassing would be considered reasonable by those who options are most respected here.

Check out function WP_Query->get_posts() in wp-includes/query.php.

There is a filter called 'posts_request' that lets you replace the 
entire query.


Jennifer Hodgdon * Poplar ProductivityWare
Drupal, WordPress, and custom Web programming

More information about the wp-hackers mailing list