Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
comments_array - 过滤评论数组 - WordPress钩子 - WordPress动力
当前浏览:首页 / WordPress钩子 / comments_array

apply_filters( 'comments_array', array $comments, int $post_ID )

过滤评论数组


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 2 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "2cf9b82b287c645cce99d1f71839ef8e" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "8a120dc4a793b62501729a9a51316687" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

array

comment 评论more...


参数

$comments

(array) 提供给评论模板的评论数组。

$post_ID

(int) 文章ID。


更多信息

在comments_template中使用,它允许您捕获通过post查询的所有评论。



源码

查看源码 官方文档


更新日志

版本描述
2.1.0开始引入

使用示例

  • 示例1

    如果要隐藏文章的所有现有评论,请使用以下函数返回空数组:

    add_filter( 'comments_array', '__return_empty_array' );