WP_Term_Query::query() public WP 4.6.0
Sets up the query and retrieves the results.
The return type varies depending on the value passed to $args['fields']. See WP_Term_Query::get_terms() for details.
{} It's a method of the class: WP_Term_Query{}
No Hooks.
Return
WP_Term[]|Int[]|String[]|String
. Array of terms, or number of terms as numeric string when 'count' is passed as a query var.
Usage
$WP_Term_Query = new WP_Term_Query(); $WP_Term_Query->query( $query );
- $query(string|array) (required)
- Array or URL query string of parameters.
Changelog
Since 4.6.0 | Introduced. |
Code of WP_Term_Query::query() WP Term Query::query WP 5.7
public function query( $query ) {
$this->query_vars = wp_parse_args( $query );
return $this->get_terms();
}