diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index c4090174f..4a2e7c2e7 100644
|
|
|
function wp_media_upload_handler() { |
| 852 | 852 | * |
| 853 | 853 | * @since 2.6.0 |
| 854 | 854 | * @since 4.2.0 Introduced the `$return` parameter. |
| | 855 | * @since 4.8.0 Introduced the 'id' option within the `$return` parameter. |
| 855 | 856 | * |
| 856 | 857 | * @param string $file The URL of the image to download. |
| 857 | 858 | * @param int $post_id The post ID the media is to be associated with. |
| 858 | 859 | * @param string $desc Optional. Description of the image. |
| 859 | | * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL). Default 'html'. |
| | 860 | * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL), or 'id' (attachment ID). Default 'html'. |
| 860 | 861 | * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise. |
| 861 | 862 | */ |
| 862 | 863 | function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) { |
| … |
… |
function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) |
| 886 | 887 | if ( is_wp_error( $id ) ) { |
| 887 | 888 | @unlink( $file_array['tmp_name'] ); |
| 888 | 889 | return $id; |
| | 890 | // If attachment id was requested, return it early. |
| | 891 | } elseif ( $return === 'id' ) { |
| | 892 | return $id; |
| 889 | 893 | } |
| 890 | 894 | |
| 891 | 895 | $src = wp_get_attachment_url( $id ); |