get_search_query
云策文档标注
概述
本文档介绍 WordPress 中的 get_search_query 过滤器,用于过滤搜索查询变量的内容。它允许开发者在检索搜索查询时修改或处理查询字符串。
关键要点
- get_search_query 是一个过滤器,用于过滤搜索查询变量的内容。
- 参数 $search 是搜索查询变量的内容,类型为 mixed。
- 通过 apply_filters 调用,例如:$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
- 相关函数 get_search_query() 用于检索搜索查询变量。
- 自 WordPress 2.3.0 版本引入。
代码示例
$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
原文内容
Filters the contents of the search query variable.
Parameters
$searchmixed-
Contents of the search query variable.
Source
$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |