Changeset 40597
- Timestamp:
- 05/09/2017 11:25:56 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r40400 r40597 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 */ … … 886 887 if ( is_wp_error( $id ) ) { 887 888 @unlink( $file_array['tmp_name'] ); 889 return $id; 890 // If attachment id was requested, return it early. 891 } elseif ( $return === 'id' ) { 888 892 return $id; 889 893 }
Note: See TracChangeset
for help on using the changeset viewer.