wp_update_post
wp_update_post ( $postarr = array(), $wp_error = false, $fire_after_hooks = true )
Parameters:- (array|object) postarr Optional. Post data. Arrays are expected to be escaped, objects are not. See wp_insert_post() for accepted arguments. Default array.
- (bool) wp_error Optional. Whether to return a WP_Error on failure. Default false.
- (bool) fire_after_hooks Optional. Whether to fire the after insert hooks. Default true.
Returns:- (int|WP_Error) The post ID on success. The value 0 or WP_Error on failure.
Defined at:Change Log: - Introduced in WordPress: 1.0.0
- Deprecated in WordPress: —
Description
Updates a post with new post data.The date does not have to be set for drafts. You can set the date and it will
not be overridden.