diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index ed850ec02d..f46ef83b63 100644
|
|
function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid |
413 | 413 | * Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). |
414 | 414 | * |
415 | 415 | * @since 2.6.0 |
| 416 | * @since 5.3.0 Made `$post_id` parameter optional. |
416 | 417 | * |
417 | 418 | * @param array $file_array Array similar to a `$_FILES` upload array. |
418 | | * @param int $post_id The post ID the media is associated with. |
| 419 | * @param int $post_id Optional. The post ID the media is associated with. |
419 | 420 | * @param string $desc Optional. Description of the side-loaded file. Default null. |
420 | 421 | * @param array $post_data Optional. Post data to override. Default empty array. |
421 | 422 | * @return int|object The ID of the attachment or a WP_Error on failure. |
422 | 423 | */ |
423 | | function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data = array() ) { |
| 424 | function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { |
424 | 425 | $overrides = array( 'test_form' => false ); |
425 | 426 | |
426 | 427 | $time = current_time( 'mysql' ); |
… |
… |
function wp_media_upload_handler() { |
924 | 925 | * @since 2.6.0 |
925 | 926 | * @since 4.2.0 Introduced the `$return` parameter. |
926 | 927 | * @since 4.8.0 Introduced the 'id' option within the `$return` parameter. |
| 928 | * @since 5.3.0 Made the `$post_id` parameter optional |
927 | 929 | * |
928 | 930 | * @param string $file The URL of the image to download. |
929 | | * @param int $post_id The post ID the media is to be associated with. |
| 931 | * @param int $post_id Optional. The post ID the media is to be associated with. |
930 | 932 | * @param string $desc Optional. Description of the image. |
931 | 933 | * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL), or 'id' (attachment ID). Default 'html'. |
932 | 934 | * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise. |
933 | 935 | */ |
934 | | function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) { |
| 936 | function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'html' ) { |
935 | 937 | if ( ! empty( $file ) ) { |
936 | 938 | |
937 | 939 | // Set variables for storage, fix file filename for query strings. |