Get Attachment ID from media_sideload_image()


In this scenario,

$image = media_sideload_image($downloadable_path, $post_id);

The $image variable now returns the full HTML, like this (with single quotes for some reason)

<img src="" alt="" />

Which isn’t so bad, unless we want to get Just the image URL, or maybe the Thumbnail URL, or just the attachment ID.
Here is how to do it.