media_sideload_image ( $file, $post_id, $desc = null )
- (string) $file The URL of the image to download
- (int) $post_id The post ID the media is to be associated with
- (string) $desc Optional. Description of the image
- (string|WP_Error) Populated HTML img tag on success
- Introduced in WordPress: 2.6.0
- Deprecated in WordPress: -
Download an image from the specified URL and attach it to a post.