[wp-hackers] Applying a filter to the main loop only

Dion Hulse (dd32) wordpress at dd32.id.au
Tue Jul 27 07:26:09 UTC 2010


On Tue, 27 Jul 2010 05:49:37 +1000, John Blackbourn  
<johnbillion+wp at gmail.com> wrote:

> On Mon, Jul 26, 2010 at 8:42 PM, Otto <otto at ottodestruct.com> wrote:
>> Hang on, I'm confused...
>>
>> You guys keep mentioning the main "loop", but then go on to talk about
>> modifying the query for it and such. But the main post SELECT query is
>> run and done before the template is ever called, certainly before you
>> ever get to any "loop". It helps determine what template is called, in
>> fact.
>
> That's true but I wanted a filter on the get_posts parameters, not on
> the SQL query itself.

Then as Andrew said initially here, Sounds like you want to use  
parse_request/etc that he's mentioned.

parse_request parses the Request, which is then handed over to WP_Query,  
Modify it at parse_request, modify the current page request before any  
queries are made; The "main" loop will utilise that.


Dion Hulse / dd32
Contact:
  e: contact at dd32.id.au
  Web: http://dd32.id.au/


More information about the wp-hackers mailing list