Update a post / page
wp_update_contentUpdate an existing WordPress post or page by passing only the fields you need to change. For partial content edits, read the current item first, then replace the body with updated content.
Instructions
Update an existing item. Only the fields you pass are changed. Note that content replaces the whole body — read it with wp_get_content first if you are making a partial edit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The item to update. | |
| date | No | ISO 8601; required when status is future. | |
| meta | No | Registered meta fields only. | |
| site | No | Configured site name. Omit to use the default site. | |
| slug | No | ||
| tags | No | ||
| title | No | ||
| author | No | ||
| parent | No | ||
| status | No | Defaults to draft on create — publish explicitly when intended. | |
| content | No | Full body as HTML or Gutenberg block markup. Replaces existing content. | |
| excerpt | No | ||
| template | No | ||
| post_type | No | Post type slug, e.g. post, page, or a custom type. | post |
| categories | No | ||
| featured_media | No | Media ID for the featured image. |