close_comments_for_post_types
云策文档标注
概述
close_comments_for_post_types 是一个 WordPress 过滤器,用于控制自动关闭评论的文章类型列表。开发者可以通过此 Hook 修改默认配置,以扩展或限制自动关闭评论的功能范围。
关键要点
- 过滤器名称:close_comments_for_post_types
- 参数:$post_types,一个字符串数组,包含文章类型名称
- 默认值:array( 'post' ),仅对 'post' 文章类型生效
- 相关函数:_close_comments_for_old_posts() 和 _close_comments_for_old_post(),用于动态关闭旧文章的评论
- 引入版本:WordPress 3.2.0
原文内容
Filters the list of post types to automatically close comments for.
Parameters
$post_typesstring[]-
An array of post type names.
Source
$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |