Create a duplicate media attachment post

by fullmoonfriday   Last Updated January 14, 2018 12:08 PM

I need to copy an attachment post into a new folder. I currently have attachments in a custom directory and require to copy / duplicate these attachments to a new post / file in a separate folder. I would like to know if there is a function specific for this or do I need to use the media_handle_sideload() or media_handle_upload() function and build the function that copies the file and create a new post. Thanks in advance.

Related Questions

front end post and uploads for custom post type

Updated April 25, 2018 14:08 PM