wp_update_post ( $postarr = array(), $wp_error = false )

  • (array|object) $postarr Optional. Post data. Arrays are expected to be escaped, objects are not. Default array.
  • (bool) $wp_error Optional. Allow return of WP_Error on failure. Default false.
  • (int|WP_Error) The value 0 or WP_Error on failure. The post ID on success.
Defined at:


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

Related Functions

wp_update_site, wp_delete_post, wp_update_term, wp_update_user, wp_update_core

Top Google Results

User discussions

wpseek mobile