[wp-trac] [WordPress Trac] #5461: Add ability to set description for XML-RPC file uploads
WordPress Trac
noreply at wordpress.org
Fri Feb 21 18:34:49 UTC 2014
#5461: Add ability to set description for XML-RPC file uploads
--------------------------------------+-----------------------------
Reporter: josephscott | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: XML-RPC | Version: 2.3.1
Severity: normal | Resolution:
Keywords: 2nd-opinion dev-feedback | Focuses:
--------------------------------------+-----------------------------
Changes (by chriscct7):
* keywords: needs-patch => 2nd-opinion dev-feedback
* type: enhancement => feature request
Comment:
Hi Joseph,
Thanks for the great idea, and sorry it took so long to get you a
response. The original file function you referenced no longer exists, and
instead now aliases to wp:mw_newMediaObject.
In the current release, to add the description, what you could do is just
have a plugin that hooks into `xmlrpc_call_success_mw_newMediaObject` and
use the $id and $args parameters to set the description:
{{{
function 5461_example( $id, $args ){
// validate the $args['description'] parameter
// use update_post_meta, where $id is the post_id of the attachment to
save $args['description'] as the description
}
add_action( 'xmlrpc_call_success_mw_newMediaObject', '5461_example', 10 ,
2);
}}}
Basically, in your XMLRPC call to wp:mw_newMediaObject, add a parameter
for the description in your $args array and then use a plugin that hooks
into the wp:mw_newMediaObject action after uploading the attachment to
save that description into the description of the attachment post.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/5461#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list