untrash_comment
云策文档标注
概述
untrash_comment 是一个 WordPress 动作钩子,在评论从垃圾箱恢复之前立即触发。它允许开发者在恢复操作执行前执行自定义代码。
关键要点
- 触发时机:在评论从垃圾箱恢复之前立即执行。
- 参数:$comment_id(评论 ID 作为数字字符串)和 $comment(要恢复的 WP_Comment 对象)。
- 版本历史:从 WordPress 2.9.0 引入,4.9.0 版本添加了 $comment 参数。
- 相关函数:wp_untrash_comment() 用于从垃圾箱移除评论。
代码示例
do_action( 'untrash_comment', $comment->comment_ID, $comment );
原文内容
Fires immediately before a comment is restored from the Trash.
Parameters
$comment_idstring-
The comment ID as a numeric string.
$commentWP_Comment-
The comment to be untrashed.
Source
do_action( 'untrash_comment', $comment->comment_ID, $comment );