Is there a way for me to add an <img>
tag in a Post, but then have a plugin download that image, and put it on the server for me instead of me needing to manually download the file from online to my computer and then upload it to the server?
Thanks
3 Answers
Sure. You could hook the save_post
action, use WP_Http
class to download it and then insert it as an attachment using wp_insert_attachment
and wp_update_attachment_metadata()
.
It’s not trivial but shouldn’t be that hard.