WP_Query::set() WordPress Method
The WP_Query::set() method is used to set query variables for use in WP_Query::query(). Query variables are set as an array of key => value pairs. For example: $query->set( 'post_type', 'page' ); The above would set the post_type query variable to "page".
WP_Query::set( string $query_var, mixed $value ) #
Sets the value of a query variable.
Parameters
- $query_var
(string)(Required)Query variable key.
- $value
(mixed)(Required)Query variable value.
Source
File: wp-includes/class-wp-query.php
public function set( $query_var, $value ) { $this->query_vars[ $query_var ] = $value; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |