I am attempting to copy a file from an external URL and then reference the local copy of the image via a WordPress shortcode.
So far I have managed to copy the external image to the media library using media_sideload_image()
, but am unable to find a solution to retrieve the newly uploaded file and use it within an tag.
Does WordPress offer any solution to find a file within an unknown subfolder in the media library? Or is there a method of copying an image with media_sideload_image()
to a specific directory in the media library?