transition_comment_status
云策文档标注
概述
transition_comment_status 是一个 WordPress 动作钩子,在评论状态发生转换时触发,允许开发者执行自定义操作。
关键要点
- 触发时机:当评论状态(如从“待审核”到“已批准”)发生转换时
- 参数:$new_status(新状态字符串)、$old_status(旧状态字符串)、$comment(WP_Comment 对象)
- 源调用:do_action( 'transition_comment_status', $new_status, $old_status, $comment )
- 相关函数:wp_transition_comment_status() 用于处理状态转换并调用此钩子
- 版本历史:自 WordPress 2.7.0 引入
原文内容
Fires when the comment status is in transition.
Parameters
$new_statusstring-
The new comment status.
$old_statusstring-
The old comment status.
$commentWP_Comment-
Comment object.
Source
do_action( 'transition_comment_status', $new_status, $old_status, $comment );
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |