wpseek.com
WordPress开发者和主题制作者的搜索引擎
get_search_query › WordPress Function
Since2.3.0
已弃用n/a
› get_search_query ( $escaped = true )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Retrieves the contents of the search WordPress query variable.
The search query string is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.Related Functions: the_search_query, get_search_form, _admin_search_query, get_search_link, get_search_template
源码
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;
}