Using a from, I want to create a CPT record - this is fine.
I also want to upload files - But I don't want the files to be included in the CPT record, or added to WP media
Have added the generic fields in the form ok. cred_form_validate has access to the files - but I'm thinking it's going to easier to add the fields to the CPT and then delete the files from media.
What is the best way to delete the files from WP media after upload is complete in cred_save_data?

Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Terry,
Thank you for getting in touch.
I also want to upload files - But I don't want the files to be included in the CPT record, or added to WP media
Not sure what you mean by this, is it that you want the file to be uploaded in a completely different directory?
What is the best way to delete the files from WP media after upload is complete in cred_save_data?
You can do this with the cred_save_data hook however it would require that you employ the use of custom code to achieve.
What I mean is that you're going to have to get the ID of the file from the url using the function below.
https://developer.wordpress.org/reference/functions/attachment_url_to_postid/
Then delete that file once you've gotten the ID using this function below.
https://developer.wordpress.org/reference/functions/wp_delete_attachment/
Please let me know if this was able to help.
Thanks,
Shane