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

  • (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.
  • (int|WP_Error) The post ID on success. The value 0 or WP_Error on failure.
Defined at:
Change Log:
  • 3: .
  • 5: .


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.

Related Functions

wp_update_site, wp_update_term, wp_update_user, wp_delete_post, wp_update_core

Top Google Results

User discussions

wpseek mobile