diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index fc8ce0f..b9e2a32 100755
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -834,7 +834,7 @@ function wp_media_upload_handler() {
  * @param string $file    The URL of the image to download.
  * @param int    $post_id The post ID the media is to be associated with.
  * @param string $desc    Optional. Description of the image.
- * @param string $return  Optional. Accepts 'html' (image tag html) or 'src' (URL). Default 'html'.
+ * @param string $return  Optional. Accepts 'html' (image tag html) 'id' (image ID) or 'src' (URL). Default 'html'.
  * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise.
  */
 function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) {
@@ -862,6 +862,10 @@ function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' )
 			return $id;
 		}
 
+		if( $return === 'id' ){
+			return $id;
+		}
+
 		$src = wp_get_attachment_url( $id );
 	}
 
