| | 962 | |
| | 963 | /** |
| | 964 | * Retrieve query variable. |
| | 965 | * |
| | 966 | * @since 4.9.0 |
| | 967 | * |
| | 968 | * @access public |
| | 969 | * |
| | 970 | * @param string $query_var Query variable key. |
| | 971 | * @param mixed $default Optional. Value to return if the query variable is not set. Default null. |
| | 972 | * @return mixed Contents of the query variable. |
| | 973 | */ |
| | 974 | public function get( $query_var, $default = null ) { |
| | 975 | if ( isset( $this->query_vars[ $query_var ] ) ) { |
| | 976 | return $this->query_vars[ $query_var ]; |
| | 977 | } |
| | 978 | |
| | 979 | return $default; |
| | 980 | } |
| | 981 | |
| | 982 | /** |
| | 983 | * Set query variable. |
| | 984 | * |
| | 985 | * @since 4.9.0 |
| | 986 | * @access public |
| | 987 | * |
| | 988 | * @param string $query_var Query variable key. |
| | 989 | * @param mixed $value Query variable value. |
| | 990 | */ |
| | 991 | public function set( $query_var, $value ) { |
| | 992 | $this->query_vars[$query_var] = $value; |
| | 993 | } |