'media'=>"(media) An array of media to attach to the post. To upload media, the entire request should be multipart/form-data encoded. Accepts jpg, jpeg, png, gif, pdf, doc, ppt, odt, pptx, docx, pps, ppsx, xls, xlsx, key. Audio and Video may also be available. See <code>allowed_file_types</code> in the options response of the site endpoint.<br /><br /><strong>Example</strong>:<br />".
'media_urls'=>"(array) An array of URLs to upload to the post. Errors produced by media uploads, if any, will be in `media_errors` in the response.",
'attrs'=>"(array) An array of attributes (`title`, `description`, `caption` `alt` for images, `artist` for audio, `album` for audio, and `parent_id`) are supported to assign to the media uploaded via the `media` or `media_urls` properties. You must use a numeric index for the keys of `attrs` which follows the same sequence as `media` and `media_urls`. <br /><br /><strong>Example</strong>:<br />".
"<code>curl \<br />--form 'media[]=@/path/to/file1.jpg' \<br />--form 'media_urls[]=http://example.com/file2.jpg' \<br /> \<br />--form 'attrs[0][caption]=This will be the caption for file1.jpg' \<br />--form 'attrs[1][title]=This will be the title for file2.jpg' \<br />-H 'Authorization: BEARER your-token' \<br />'https://public-api.wordpress.com/rest/v1/sites/123/posts/new'</code>",
),
'response_format'=>array(
'media'=>'(array) Array of uploaded media objects',
'errors'=>'(array) Array of error messages of uploading media failures',
if('0'!=$file['error']){// There's already an error.
return$file;
}
if(defined('WP_IMPORTING')){
return$file;
}
$space_left=get_upload_space_available();
$file_size=filesize($file['tmp_name']);
if($space_left<$file_size){
/* translators: %s: Required disk space in kilobytes. */
$file['error']='rest_upload_limited_space|'.sprintf(__('Not enough space to upload. %s KB needed.','default'),number_format(($file_size-$space_left)/KB_IN_BYTES));
/* translators: %s: Maximum allowed file size in kilobytes. */
$file['error']='rest_upload_file_too_big|'.sprintf(__('This file is too big. Files must be less than %s KB in size.','default'),get_site_option('fileupload_maxk',1500));
}
if(upload_is_user_over_quota(false)){
$file['error']='rest_upload_user_quota_exceeded|'.__('You have used your space quota. Please delete files before uploading.','default');