set_query_var

Set query variable.

Description

set_query_var( (string) $var, (mixed) $value ); 

Parameters (2)

0. $var (string)
Query variable key.
1. $value (mixed)
Query variable value.

Usage

  1. if ( !function_exists( 'set_query_var' ) ) { 
  2. require_once ABSPATH . WPINC . '/query.php'; 
  3.  
  4. // Query variable key. 
  5. $var = ''; 
  6.  
  7. // Query variable value. 
  8. $value = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = set_query_var($var, $value); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/query.php  
  1. function set_query_var( $var, $value ) { 
  2. global $wp_query; 
  3. $wp_query->set( $var, $value );