diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index c6b2dcd..de937cf 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -848,7 +848,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' (Media 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' ) {
@@ -884,17 +884,21 @@ function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' )
 	}
 
 	// Finally, check to make sure the file has been saved, then return the HTML.
-	if ( ! empty( $src ) ) {
-		if ( $return === 'src' ) {
-			return $src;
-		}
-
-		$alt = isset( $desc ) ? esc_attr( $desc ) : '';
-		$html = "<img src='$src' alt='$alt' />";
-		return $html;
-	} else {
+	if ( empty( $src ) ) {
 		return new WP_Error( 'image_sideload_failed' );
 	}
+
+	if ( $return === 'src' ) {
+		return $src;
+	}
+
+	if ( $return === 'id' ) {
+		return $id;
+	}
+
+	$alt = isset( $desc ) ? esc_attr( $desc ) : '';
+	$html = "<img src='$src' alt='$alt' />";
+	return $html;
 }
 
 /**
