Downloads an external image and optionally attaches it to a post.
Contains most of core’s media_sideload_image() but returns an attachment ID instead of HTML.
Note: this function does not validate the domain that the image is coming from. Please make sure to validate this before downloading the image. Should only pull down images from trusted sources.
Note: This function does not support GET params because these will not work on WPCOM production servers see r157060
|$image_url||string||URL of the image.|
|$post_ID||int||ID of the post it should be attached to.|
$thumbnail_id: id of the thumbnail attachment post id