media_handle_sideload on a file already on server


I want to attach a file already on server but outside the wp uploads directory to a post, so I tried the media_handle_sideload and used the download_url() on the file’s URL I’m trying to attach, however for some reason, the download_url cannot access my server, is there a work around that I can do so instead of giving media_handle_sideload a $_FILES array I can give it the file absolute path? Or can I move a file already on server to the temp folder?

MacLover 2 years 2020-12-25T01:10:26-05:00 0 Answers 3 views 0

Leave an answer