I need to delete the files from the server every 15 days because it is overloaded on my server. So I tried to get all the file url in wp_rg_lead and wp_rg_lead_detail table. My question is there a hook or filter that can delete the file using the URL only? I know Wordpress has a wp_delete_attachment hook, but it is only for the WP media library.
This is my code
global $wpdb;
$get_data = $wpdb->get_results("SELECT tbl2.lead_id, tbl2.form_id,
tbl2.value FROM ".$wpdb->prefix."_rg_lead tbl1 LEFT JOIN ".$wpdb->prefix."_rg_lead_detail
tbl2 ON tbl1.form_id=tbl2.form_id WHERE
tbl1.date_created < DATE_SUB(DATE(now()), INTERVAL 15 DAY)
AND tbl2.value LIKE '%/wp-content/uploads/gravity_forms/%' ");
foreach($get_data as $data){
//delete hook?
}