diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 8e929f38a7..6626937568 100644
|
a
|
b
|
function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid |
| 430 | 430 | * @since 2.6.0 |
| 431 | 431 | * @since 5.3.0 The `$post_id` parameter was made optional. |
| 432 | 432 | * |
| 433 | | * @param array $file_array Array that represents a `$_FILES` upload array. |
| 434 | | * @param int $post_id Optional. The post ID the media is associated with. |
| 435 | | * @param string $desc Optional. Description of the side-loaded file. Default null. |
| 436 | | * @param array $post_data Optional. Post data to override. Default empty array. |
| | 433 | * @param string[] $file_array Array that represents a `$_FILES` upload array. |
| | 434 | * @param int $post_id Optional. The post ID the media is associated with. |
| | 435 | * @param string $desc Optional. Description of the side-loaded file. Default null. |
| | 436 | * @param array $post_data Optional. Post data to override. Default empty array. |
| 437 | 437 | * @return int|WP_Error The ID of the attachment or a WP_Error on failure. |
| 438 | 438 | */ |
| 439 | 439 | function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { |
| 440 | 440 | $overrides = array( 'test_form' => false ); |
| 441 | 441 | |
| 442 | | $time = current_time( 'mysql' ); |
| 443 | | $post = get_post( $post_id ); |
| 444 | | |
| 445 | | if ( $post ) { |
| 446 | | if ( substr( $post->post_date, 0, 4 ) > 0 ) { |
| | 442 | if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) { |
| | 443 | $time = $post_data['post_date']; |
| | 444 | } else { |
| | 445 | $post = get_post( $post_id ); |
| | 446 | if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) { |
| 447 | 447 | $time = $post->post_date; |
| | 448 | } else { |
| | 449 | $time = current_time( 'mysql' ); |
| 448 | 450 | } |
| 449 | 451 | } |
| 450 | 452 | |