wpcom_vip_download_image

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

Parameters

Name Type Description
$image_url string URL of the image.
$post_ID int ID of the post it should be attached to.

Return Value

$thumbnail_id: id of the thumbnail attachment post id

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.