set_query_var( string $var, mixed $value )
Set query variable.
Description
Parameters
- $var
-
(string) (Required) Query variable key.
- $value
-
(mixed) (Required) Query variable value.
Source
File: wp-includes/query.php
function set_query_var( $var, $value ) { global $wp_query; $wp_query->set( $var, $value ); }
Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |
One use case for this is to pass variable to template file when calling it with
get_template_part()
.Now in you template you can then call it.
This is a way to pass variables to the called files.
On the a.php file:
On the b.php file:
On the c.php file: