wp_creating_autosave

wp_creating_autosave

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.8

do_action('wp_creating_autosave') is found 3 times:

  • /wp-admin/includes/post.php line 2002
    1998
    1999
    2000
    2001
    2002
    2003
    2004
    2005
    2006
    2007
         *
         * @param array $new_autosave Post array - the autosave that is about to be saved.
         * @param bool  $is_update    Whether this is an existing autosave.
         */
        do_action( 'wp_creating_autosave', $new_autosave, true );
        return wp_update_post( $new_autosave );
    }
     
    // _wp_put_post_revision() expects unescaped.
    $post_data = wp_unslash( $post_data );
  • /wp-admin/includes/post.php line 2015
    2012
    2013
    2014
    2015
    2016
    2017
    2018
    2019
    2020
    2021
        if ( ! is_wp_error( $revision ) && 0 !== $revision ) {
     
            /** This action is documented in wp-admin/includes/post.php */
            do_action( 'wp_creating_autosave', get_post( $revision, ARRAY_A ), false );
        }
     
        return $revision;
    }
     
    /**
  • /wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php line 416
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
        $new_autosave['ID']          = $old_autosave->ID;
        $new_autosave['post_author'] = $user_id;
     
        /** This filter is documented in wp-admin/post.php */
        do_action( 'wp_creating_autosave', $new_autosave );
     
        // wp_update_post() expects escaped array.
        $revision_id = wp_update_post( wp_slash( $new_autosave ) );
    } else {
        // Create the new autosave as a special post revision.
        $revision_id = _wp_put_post_revision( $post_data, true );

See this hook used in plugins: