media_handle_sideload ( $file_array, $post_id = 0, $desc = null, $post_data = array() )
- (array) file_array Array similar to a `$_FILES` upload array.
- (int) post_id Optional. The post ID the media is associated with.
- (string) desc Optional. Description of the side-loaded file. Default null.
- (array) post_data Optional. Post data to override. Default empty array.
Defined at:Change Log:
- (int|WP_Error) The ID of the attachment or a WP_Error on failure.
- Introduced in WordPress: 2.6.0
- Deprecated in WordPress: —
Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().