get_query_var

函数


get_query_var ( $var, $default = '' )
参数
  • (string)
    $var
    The variable key to retrieve.
    Required:
  • (mixed)
    $default
    Optional. Value to return if the query variable is not set. Default empty.
    Required:
    Default: (empty)
返回值
  • (mixed) Contents of the query variable.
定义位置
  • wp-includes/query.php
    , line 26
引入
1.5.0
弃用

检索WP_Query类中一个查询变量的值。

function get_query_var( $var, $default = '' ) {
	global $wp_query;
	return $wp_query->get( $var, $default );
}