diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 0938257da7..cc5072884a 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -281,15 +281,17 @@ function media_send_to_editor( $html ) {
  * Saves a file submitted from a POST request and create an attachment post for it.
  *
  * @since 2.5.0
+ * @since 6.2.0 The `$post_id` parameter was made optional.
  *
  * @param string $file_id   Index of the `$_FILES` array that the file was sent.
- * @param int    $post_id   The post ID of a post to attach the media item to. Required, but can
- *                          be set to 0, creating a media item that has no relationship to a post.
+ * @param int    $post_id   Optional. The post ID of a post to attach the media item to.
+ *                          If 0, creates a media item that has no relationship to a post.
+ *                          Default 0.
  * @param array  $post_data Optional. Overwrite some of the attachment.
  * @param array  $overrides Optional. Override the wp_handle_upload() behavior.
  * @return int|WP_Error ID of the attachment or a WP_Error object on failure.
  */
-function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' => false ) ) {
+function media_handle_upload( $file_id, $post_id = 0, $post_data = array(), $overrides = array( 'test_form' => false ) ) {
 	$time = current_time( 'mysql' );
 	$post = get_post( $post_id );
 
