wp_creating_autosave action-hookWP 4.1.0

Fires before an autosave is stored.

Usage

add_action( 'wp_creating_autosave', 'wp_kama_creating_autosave_action', 10, 2 );

/**
 * Function for `wp_creating_autosave` action-hook.
 * 
 * @param array $new_autosave Post array - the autosave that is about to be saved.
 * @param bool  $is_update    Whether this is an existing autosave.
 *
 * @return void
 */
function wp_kama_creating_autosave_action( $new_autosave, $is_update ){

	// action...
}
$new_autosave(array)
Post array - the autosave that is about to be saved.
$is_update(true|false)
Whether this is an existing autosave.

Changelog

Since 4.1.0 Introduced.
Since 6.4.0 The $is_update parameter was added to indicate if the autosave is being updated or was newly created.

Where the hook is called

wp_create_post_autosave()
wp_creating_autosave
WP_REST_Autosaves_Controller::create_post_autosave()
wp_creating_autosave
wp-admin/includes/post.php 1986
do_action( 'wp_creating_autosave', $new_autosave, true );
wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php 412
do_action( 'wp_creating_autosave', $new_autosave );
wp-admin/includes/post.php 1999
do_action( 'wp_creating_autosave', get_post( $revision, ARRAY_A ), false );

Where the hook is used in WordPress

wp-includes/default-filters.php 744
add_action( 'wp_creating_autosave', 'wp_autosave_post_revisioned_meta_fields' );