[wp-hackers] Loops and Cloning

Malaiac malaiac at gmail.com
Sun Nov 2 09:27:09 GMT 2008


2008/11/1 Jess Planck <jess at funroe.net>:
> On Oct 31, 2008, at 9:27 PM, Mark Jaquith wrote:
>
>> It's better to just instantiate your own WP_Query object.

Trouble with instantiating another WP_Query is that filters and
actions have NO way to know on which wp_query object they are working
on.
What if I need some filtering on one custom wp_query object, but none
on the main wp_query loop ?
The filter has to work depending on current query_vars... but how
could it know them ? (global $wp_query;
print_r($wp_query->query_vars); will work on the main wp_query, but
not on the custom one)

Possible solutions :
adding an optional query_var "name"  to each wp_query object


More information about the wp-hackers mailing list