get_search_query()
最后更新于:2021-11-27 00:07:36
get_search_query( bool$escaped=true)Retrieves the contents of the search GeChiUI query variable.
参数
- $escaped
-
(bool) (Optional) Whether the result is escaped. Only use when you are later escaping it. Do not use unescaped.
Default value: true
响应
(string)
源文件
文件: gc-includes/general-template.php
function get_search_query( $escaped = true ) {
/**
* Filters the contents of the search query variable.
*
* @since 2.3.0
*
* @param mixed $search Contents of the search query variable.
*/
$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
if ( $escaped ) {
$query = esc_attr( $query );
}
return $query;
}