WP_Query::query()
Sets up the WordPress query by parsing query string.
Method of the class: WP_Query{}
No Hooks.
Return
WP_Post[]|Int[]
. Array of post objects or post IDs.
Usage
global $wp_query; $wp_query->query( $query );
- $query(string|array) (required)
- URL query string or array of query arguments.
Notes
- See: WP_Query::parse_query() for all available arguments.
Changelog
Since 1.5.0 | Introduced. |
WP_Query::query() WP Query::query code WP 6.6.2
public function query( $query ) { $this->init(); $this->query = wp_parse_args( $query ); $this->query_vars = $this->query; return $this->get_posts(); }