WP_Query::get
Retrieves the value of a query variable.
Метод класса: WP_Query{}
Хуков нет.
Возвращает
Разное. Contents of the query variable.
Использование
global $wp_query; $wp_query->get( $query_var, $default_value );
- $query_var(строка) (обязательный)
- Query variable key.
- $default_value(разное)
- Value to return if the query variable is not set.
По умолчанию:empty string
Список изменений
| С версии 1.5.0 | Введена. |
| С версии 3.9.0 | The $default_value argument was introduced. |
Код WP_Query::get() WP Query::get WP 7.0
public function get( $query_var, $default_value = '' ) {
return $this->query_vars[ $query_var ] ?? $default_value;
}