#19515 closed enhancement (worksforme)
Helper functions for accessing 'tax_query', 'query', 'meta_query' WP Query properties
Reported by: | ejdanderson | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Query | Keywords: | needs-patch |
Focuses: | Cc: |
Description
In the current state, to access the 'tax_query', 'query', 'meta_query', we must do so via the global $wp_query. It would be useful have access to these properties via getters, similar to get_queried_object or get_query_var.
Example use case: Having a second loop on a page displaying a filtered or adjusted version of the main loop.
Change History (4)
#2
follow-up:
↓ 3
@
13 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
- Type changed from feature request to enhancement
#3
in reply to:
↑ 2
@
13 years ago
Replying to scribu:
The tax_query property is accessible from any WP_Query instance:
$my_query = new WP_Query( array( 'tax_query' => array( ... ) ) ); var_dump( $my_query->tax_query );
Yes, but we could also do that with the get_queried_object. get_query_var, have_comments etc.. methods, which are just wrappers for the global $wp_query object methods. Is it because these are properties and not methods?
Note: See
TracTickets for help on using
tickets.
The tax_query property is accessible from any WP_Query instance: