pre_comment_content
云策文档标注
概述
pre_comment_content 是一个 WordPress 过滤器钩子,用于在评论内容被设置之前对其进行过滤。它允许开发者在评论数据保存前修改或处理评论内容。
关键要点
- pre_comment_content 是一个过滤器钩子,用于过滤评论内容。
- 参数 $comment_content 是字符串类型,表示要过滤的评论内容。
- 在 wp_filter_comment() 函数中调用,用于过滤和清理评论数据。
- 自 WordPress 1.5.0 版本引入。
代码示例
$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
原文内容
Filters the comment content before it is set.
Parameters
$comment_contentstring-
The comment content.
Source
$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |