mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Allow wp.uploadFile to upload the attachment to a post. props djzone, josephscott, maxcutler. fixes #13917.
git-svn-id: http://core.svn.wordpress.org/trunk@21896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8892592379
commit
3c4460fc86
@ -4894,8 +4894,13 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return new IXR_Error(500, $errorString);
|
||||
}
|
||||
// Construct the attachment array
|
||||
// attach to post_id 0
|
||||
$post_id = 0;
|
||||
if ( ! empty( $data['post_id'] ) ) {
|
||||
$post_id = (int) $data['post_id'];
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) )
|
||||
return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
|
||||
}
|
||||
$attachment = array(
|
||||
'post_title' => $name,
|
||||
'post_content' => '',
|
||||
|
Loading…
Reference in New Issue
Block a user