posts_search_orderby
云策文档标注
概述
posts_search_orderby 是一个 WordPress 过滤器,用于修改搜索查询结果排序时的 ORDER BY 子句。它允许开发者在执行搜索时自定义排序逻辑。
关键要点
- 过滤器名称:posts_search_orderby
- 参数:$search_orderby(ORDER BY 子句字符串)和 $query(当前 WP_Query 实例)
- 用途:在 WP_Query 搜索中过滤 ORDER BY 子句,影响搜索结果排序
- 引入版本:WordPress 3.7.0
- 相关函数:在 WP_Query::get_posts() 中调用,用于检索基于查询变量的文章数组
原文内容
Filters the ORDER BY used when ordering search results.
Parameters
Source
$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
Changelog
| Version | Description |
|---|---|
| 3.7.0 | Introduced. |