pre_post_insert
云策文档标注
概述
pre_post_insert 是一个 WordPress Hook,在将新文章插入数据库之前立即触发。它允许开发者在文章数据保存前进行自定义操作或修改。
关键要点
- 触发时机:在 wp_insert_post() 函数将新文章插入数据库之前立即执行。
- 参数:接受一个数组 $data,包含未经反斜杠转义的文章数据。
- 用途:常用于在文章保存前验证、过滤或修改数据。
- 相关函数:与 wp_insert_post() 紧密关联,用于文章插入或更新。
- 版本引入:从 WordPress 6.9.0 版本开始可用。
原文内容
Fires immediately before a new post is inserted in the database.
Parameters
$dataarray-
Array of unslashed post data.
Source
do_action( 'pre_post_insert', $data );
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |