On this page
WP_Query::set( string $query_var, mixed $value )
Sets the value of a query variable.
Parameters
$query_varstring Required-
Query variable key.
$valuemixed Required-
Query variable value.
Source
File: wp-includes/class-wp-query.php. View all references
public function set( $query_var, $value ) {
$this->query_vars[ $query_var ] = $value;
}
Related
Used By
| Used By | Description |
|---|---|
| _resolve_template_for_new_post() wp-includes/block-template.php | Sets the current WP_Query to return auto-draft posts. |
| WP_Query::get_posts() wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| set_query_var() wp-includes/query.php | Sets the value of a query variable in the WP_Query class. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/set