media_handle_sideload ( $file_array, $post_id = 0, $desc = null, $post_data = array() )

  • (string[]) file_array Array that represents 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.
  • (int|WP_Error) The ID of the attachment or a WP_Error on failure.
Defined at:
Change Log:
  • 5: .


Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().

Related Functions

media_handle_upload, wp_handle_sideload, wp_embed_handler_video, media_sideload_image, wp_handle_upload

Top Google Results

User discussions

wpseek mobile