Opened 11 months ago
Last modified 7 months ago
#21085 new enhancement
Better XML-RPC media handling
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | XML-RPC | Version: | 2.3 |
| Severity: | normal | Keywords: | mobile 2nd-opinion |
| Cc: | maxcutler, isaackeyet, marty@…, ercoli@…, gary@…, jbernal@… |
Description
In 3.4 there was a lot of improvements. For 3.5 I would like to see some major improvement in wp.uploadFile and metaWeblog.newMediaObject.
At this moment you can't insert a description, alternate text or caption. ( #5461/#18684 ). Also the file can't be attached to a post ( #13917 ).
The overwrite functionality also doesn't work ( #17604 ). Not sure why this exists since WordPress itself doesn't do this.
Also the current way isn't how WordPress does it internally. wp_handle_upload() doesn't get used (#6559).
There is also going on something wrong with mime types ( #12518 ).
Also the work from 3.4 should be implemented ( #6430 ).
Last thing is that WordPress normally also looks at the EXIF information. At this moment the XML-RPC also doesn't do that ( #18087 )
rarely related: #12493 - filter for wp_upload_bits
Attachments (1)
Change History (17)
comment:2
isaackeyet — 11 months ago
- Cc isaackeyet added
+1 for an updated way to handle new media items specifically. Images should be attachable to posts directly.
comment:3
markoheijnen — 10 months ago
There should also be an method for removing a media item. See #5310
comment:4
markoheijnen — 10 months ago
- Summary changed from mw_newMediaObject needs more functionality to Better XML-RPC media handling
comment:5
martythornley — 10 months ago
- Cc marty@… added
comment:6
daniloercoli — 10 months ago
- Cc ercoli@… added
- Cc gary@… added
Related - adding resumable upload support to the XML-RPC API: #21497
Added patch with wp.deleteMediaItem. I wonder if that method should have an extra $force_delete argument (see wp_delete_attachment)
comment:10
nacin — 9 months ago
The same parameter should be added to wp.deletePost. Currently it must be called twice to delete the post, as the first one trashes.
comment:11
follow-up:
↓ 12
nacin — 9 months ago
Note also that attachments do not have trash enabled, so wp.deleteMediaItem should not actually bother with a force_delete for now.
comment:12
in reply to:
↑ 11
koke — 9 months ago
Replying to nacin:
Note also that attachments do not have trash enabled, so wp.deleteMediaItem should not actually bother with a force_delete for now.
OK, the docs for wp_delete_attachment made me think otherwise
comment:13
nacin — 8 months ago
- Keywords 2nd-opinion added
The cap check here should be delete_post, $post_id. And in that case, the cap check should come before the invalid ID check.
Not sure why wp.deleteMediaItem should be needed — wp.deletePost is functionally equivalent. At most wp.deleteMediaItem should be an alias.
comment:14
nacin — 8 months ago
I see a lot of tickets listed in the description here, but few of them are currently slated for 3.5, and few have any recent activity. Not sure what else to do here.
comment:15
markoheijnen — 7 months ago
- Type changed from defect (bug) to enhancement
I punted it for now. It's something that need to be discussed more but way to late for 3.5 since it's an enchantment of the existing API.
comment:16
markoheijnen — 7 months ago
- Milestone changed from 3.5 to Future Release

I worry that it will be difficult to add new features and fix all of these issues without breaking existing clients. Media uploading is already a problematic area for many clients, and trying to patch wp.uploadFile/mw.newMediaObject without breaking things is likely not worth the effort.
Instead, I propose that we add a new method for creating and editing media/attachments that is better aligned with modern core functionality: