media_sideload_image()
Function: Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post.
Source: wp-admin/includes/media.php:1028
Function: Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post.
Source: wp-admin/includes/media.php:1028