wp_creating_autosave
云策文档标注
概述
wp_creating_autosave 是一个 WordPress 动作钩子,在自动保存数据存储之前触发。它允许开发者在自动保存过程中执行自定义操作。
关键要点
- 触发时机:在自动保存数据存储之前执行。
- 参数:$new_autosave(数组,即将保存的自动保存数据)和 $is_update(布尔值,指示是否为更新现有自动保存)。
- 相关函数:WP_REST_Autosaves_Controller::create_post_autosave() 和 wp_create_post_autosave() 使用此钩子。
- 版本变更:WordPress 6.4.0 添加了 $is_update 参数,4.1.0 版本引入此钩子。
原文内容
Fires before an autosave is stored.
Parameters
$new_autosavearray-
Post array – the autosave that is about to be saved.
$is_updatebool-
Whether this is an existing autosave.
Source
do_action( 'wp_creating_autosave', $new_autosave, true );