On this page
set_query_var( string $var, mixed $value )
Sets the value of a query variable in the WP_Query class.
Parameters
$varstring Required-
Query variable key.
$valuemixed Required-
Query variable value.
Source
File: wp-includes/query.php. View all references
function set_query_var( $var, $value ) {
global $wp_query;
$wp_query->set( $var, $value );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::set() wp-includes/class-wp-query.php | Sets the value of a query variable. |
Used By
| Used By | Description |
|---|---|
| build_comment_query_vars_from_block() wp-includes/blocks.php | Helper function that constructs a comment query vars array from the passed block properties. |
| wp_list_comments() wp-includes/comment-template.php | Displays a list of comments. |
| comments_template() wp-includes/comment-template.php | Loads the comment template specified in $file. |
Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/set_query_var