wp_upload_media
Uploads a user-attached media asset into the WordPress Media Library. For chat image attachments, pass image_ref from the Available Image Attachments list; the browser resolves it before WordPress receives the request. Returns an attachment_id and URL for Elementor image widgets, post content, featured images, or custom HTML/CSS.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"site_id": "<site_id>"
},
"name": "wp_upload_media"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Attachment title. | |
| caption | No | Attachment caption. | |
| content | No | Base64-encoded file content. Usually filled automatically from image_ref by the browser client. | |
| post_id | No | Optional post/page ID to attach the media to. | |
| site_id | Yes | The connected site's id returned by list_sites. Call list_sites first; do not use a URL or WordPress post ID. | |
| alt_text | No | Image alt text saved as attachment metadata. | |
| encoding | No | Content encoding. Must be base64 when content is provided. | |
| filename | No | File name to use in the Media Library. If omitted, it is inferred from image_ref when possible. | |
| image_ref | No | URI of a user-attached image, for example attachment://att_abc/photo.png. Prefer this when the user attached the asset in chat. | |
| mime_type | No | Media MIME type. Usually filled automatically from image_ref. | |
| description | No | Attachment description. |