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

Stephen Rider wp-hackers at striderweb.com
Sat Apr 11 14:11:26 GMT 2009


On Apr 5, 2009, at 11:10 PM, Stephen Rider wrote:

> On Apr 5, 2009, at 10:52 PM, 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.
>
> Yeah, it makes sense that if the filtered query == FALSE or  
> something, that could mean "don't run the query".

Michael--

Sweeping aside the personality conflicts in this thread, here is my  
thought:

1)  There is currently no way to do exactly what you want.

2) It seems as though implementing the above suggestion, (if the  
filtered query == FALSE, don't run the query), would be a fairly  
straightforward patch.

3) Thus, doing a quick patch and submitting it to Trac is probably the  
best move.  If it is useful and doesn't harm anything, I can see this  
getting committed.

(No I'm nowhere close to being a committer myself....)

Stephen


-- 
Stephen Rider
http://striderweb.com/


More information about the wp-hackers mailing list