comment_save_pre
云策文档标注
概述
comment_save_pre 是一个 WordPress 过滤器钩子,用于在评论内容更新到数据库之前对其进行过滤处理。它允许开发者修改评论内容,常用于数据清理、格式调整或安全验证。
关键要点
- comment_save_pre 是一个过滤器钩子,在评论内容保存前触发。
- 参数为 $comment_content,表示评论内容字符串。
- 源引用显示在 wp_update_comment() 函数中调用,用于更新现有评论。
- 自 WordPress 1.5.0 版本引入,是一个长期可用的核心钩子。
原文内容
Filters the comment content before it is updated in the database.
Parameters
$comment_contentstring-
The comment data.
Source
$data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |