comment_feed_orderby
云策文档标注
概述
comment_feed_orderby 是一个 WordPress 过滤器,用于在发送评论 feed 查询前修改其 ORDER BY 子句。它允许开发者自定义评论 feed 的排序方式。
关键要点
- 过滤器名称:comment_feed_orderby
- 作用:过滤评论 feed 查询的 ORDER BY 子句
- 参数:$corderbystring(ORDER BY 子句字符串)和 $query(WP_Query 实例,引用传递)
- 默认值:'comment_date_gmt DESC'
- 引入版本:WordPress 2.8.0
代码示例
$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );注意事项
- 此过滤器在 WP_Query::get_posts() 方法中使用,位于 wp-includes/class-wp-query.php 文件中。
- 参数 $query 是引用传递,允许直接修改 WP_Query 实例。
原文内容
Filters the ORDER BY clause of the comments feed query before sending.
Parameters
Source
$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |