Upload media
wp_upload_mediaUpload a JPEG, PNG, GIF, WebP or PDF file sent as base64 content and add it to the media library. WordPress checks the file as for any upload and creates the image sizes; the file is public under its URL afterwards, and each call adds a new file. The base64 text is limited to 8 MB, so the file to about 6 MB (less where the site sets a lower limit). Returns {uploaded: true, id, url}. Needs upload_files, and the right to edit post_id when the file is attached to it. A file already on the web is added with wp_upload_media_from_url. Forwarded by AlphaBridge Connect to the one site this connection reaches.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alt | No | Alternative text for an image, stored as plain text. | |
| title | No | Title of the new attachment. | |
| content | Yes | Base64-encoded file bytes (JPEG, PNG, GIF, WebP or PDF); a data: URI prefix is accepted. | |
| post_id | No | Id of a post to attach the file to; needs the right to edit that post. Default: attached to no post. | |
| filename | Yes | File name with extension, e.g. "photo.jpg". |