[wp-trac] [WordPress Trac] #14600: Make $wp_query->query always be an array
WordPress Trac
wp-trac at lists.automattic.com
Thu Aug 12 12:54:28 UTC 2010
#14600: Make $wp_query->query always be an array
-------------------------+--------------------------------------------------
Reporter: scribu | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.1
Component: Query | Version:
Severity: normal | Keywords: has-patch commit
-------------------------+--------------------------------------------------
Currently, if you do this:
{{{$query = new WP_Query( array('tag' => 'foobar', 'year' => 2010 ) );}}}
$query->query will be array('tag' => 'foobar', 'year' => 2010 ).
If you do
{{{$query = new WP_Query('tag=foobar&year=2010');}}}
$query->query will be 'tag=foobar&year=2010'.
I think it would be more useful if $query->query will be an array in both
cases. Currently, if you want to check that variable from a filter, you
always have to call wp_parse_args() yourself:
{{{
function my_posts_where($sql, $wp_query) {
$wp_query->query = wp_parse_args($wp_query->query);
if ( isset($wp_query->query['some-var'] )
// do something
...
}
add_filter('posts_where', 'my_posts_where');
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14600>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list