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.4.3

do_action('wp_creating_autosave') is found 3 times:

  • /wp-admin/includes/post.php line 1973
    		 *
    		 * @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 1986
     
    	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 412
    			$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: