Specific upload folder for PDFs in custom Post type in WP multisite

you might consider using

if(get_post_mime_type($id) == 'application/pdf'){
   ...
}

to check for pdf files.

http://codex.wordpress.org/Function_Reference/get_post_mime_type

You might also take a look at the code behind the wp_delete_attachment() function and you can hook into it with the delete attachment action. To remove the files you can use unlink()

http://php.net/manual/en/function.unlink.php

Leave a Comment