Update WordPress Media Item
wp_update_mediaUpdate WordPress media metadata to add missing alt text, titles, captions, or descriptions. Improve accessibility by backfilling alt text on images without it.
Instructions
Update metadata on an existing media item — title, alt text, caption, description, or attachment target. Most common use: backfilling alt_text on images that don't have it.
Args:
id (number): Media item ID. Required.
alt_text (string): New alt text. Pass empty string to clear.
title, caption, description (string): Optional.
post (number): Reassign to a different post/page ID (0 = unattach).
response_format (enum): markdown | json. Default 'markdown'.
Returns: The updated WPMediaItem.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Media item ID to update. | |
| post | No | Reassign to a different post/page ID. 0 = unattach. | |
| title | No | New title. | |
| caption | No | New caption. | |
| alt_text | No | New alt text. Pass empty string to clear. | |
| description | No | New description. | |
| response_format | No | Output format: 'markdown' for human-readable, 'json' for machine-readable. | markdown |