get_avatar_comment_types
云策文档标注
概述
本文档介绍 WordPress 中的 get_avatar_comment_types 过滤器,用于控制哪些评论类型允许检索头像。默认包含 'comment' 和 'note' 类型。
关键要点
- get_avatar_comment_types 是一个过滤器,允许开发者修改允许头像检索的评论类型数组。
- 默认参数 $types 是一个数组,初始值为 ['comment', 'note'],其中 'note' 类型从 WordPress 6.9.0 版本开始添加。
- 此过滤器与 is_avatar_comment_type() 函数相关,用于检查特定评论类型是否允许头像检索。
代码示例
$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment', 'note' ) );注意事项
- 此过滤器在 WordPress 3.0.0 版本中引入,6.9.0 版本新增了 'note' 评论类型支持。
- 开发者可以通过添加或移除数组元素来自定义允许头像检索的评论类型。
原文内容
Filters the list of allowed comment types for retrieving avatars.
Parameters
$typesarray-
An array of content types. Default contains
'comment'and'note'.
Source
$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment', 'note' ) );