[wp-hackers] Applying a filter to the main loop only
johnbillion+wp at gmail.com
Mon Jul 26 15:13:30 UTC 2010
I suspect I'm missing something very simple here.
I'm writing a plugin which adds a filter to pre_get_posts but the
filter should only apply when we're dealing with the main WordPress
loop (ie. the one which is constructed using the query string). There
can potentially be several loops on any given page, and the main loop
may not be the first loop on the page (so I can't apply the filter and
then remove it at the end of the first loop).
How can I determine if the current loop is the "main" loop constructed
from the query string without having to touch the loop code in the
More information about the wp-hackers