Core Function
View Source on Trac ↗ wp_insert_post()
wp_insert_post( mixed $postarr, mixed $wp_error = false, mixed $fire_after_hooks = true ) Inserts or update a post.
Parameters 1 required
| Name / Type | Description |
|---|---|
| array | $postarr { An array of elements that make up a post to update or insert. 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