WPDev.one
Core Function
View Source on Trac ↗

wp_update_post()

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

Updates a post with new post data.

Parameters 1 required

Name / Type Description
mixed

(array | object) $postarr Optional. Post data. Arrays are expected to be escaped, objects are not. See wp_insert_post() for accepted arguments. Default array.

Required
$wp_error
bool

Optional. Whether to return a WP_Error on failure. Default false.

$fire_after_hooks
bool

Optional. Whether to fire the after insert hooks. Default true.

Return Value

((int)
| WP_Error) The post ID on success. The value 0 or WP_Error on failure.

Function Information

Since Version
1.0.0
Source File
wp-includes/post.php
Advertisement