[wp-hackers] Loops and Cloning

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


2008/11/2 Otto <otto at ottodestruct.com>:
> The query_vars *ARE* part of the WP_Query object. The global $wp_query
> itself is a WP_Query object, it's just the default one.
>
> $q = new WP_Query('queryvars=whatever');
> print_r($q->query_vars);

sure.
try this instead :

$myquery = new WP_Query('queryvars=whatever');
and :
add_filter('posts_where','my_function'); > apply to all wp_query objects

function my_function($where_string)
{
// ok... now I want to act on the where only IF i'm in $myquery and
not $wp_query
// ....
// mmmm....
// maybe a get_query_var($var) to guess where I am ?
// nope.. get_query_var($var) only returns $wp_query->query_vars;
// so I'm stuck
}


More information about the wp-hackers mailing list